简体   繁体   中英

I want to click on a radio button

i am trying to click on Home Radio button, I try many methods that you can see inline // but i didn't get that. please tell me where I am doing mistakes.

  if (key==="bill-address") {
                    console.log("bill-address")
    
                    //setvalue(Data[key].formname, Data[key].value)
                    //$("[title='"+Data["dba"].formname+"']")[0].click()
                    $("[title='"+Data["bill-address"].formname+"']")[0].click()
                    //$("[title='"+Data[""].formname+"']")[0].click()
                    await wait(2000)
                }

i am trying to click on Home. please see the image

$("[title='"+Data["bill-address"].formname+"']")[0].checked = true;

Native JS solution:

 document.getElementById("_1234").checked = true;

JQuery solution:

 $("#_1234").prop("checked", true);

So in your case:

 $("[title|='"+Data["bill-address"].formname+"']")[0].prop("checked", true);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM