jquery - Using :contains() Selector on a label to affect an input -


Just searched for jQuery : in it () is selector and it uses text Want to find labels on the attribute and I want to influence the following code related input.

  & lt; Input type = "radio" name = "opt2031" id = "optid20312026" value = "1" / "gt; label style =" cursor: pointer "=" optid20312026 "& gt; device rental & lt; / Label>   

So what I want to do is get a label that contains the device rentals $ ("label: is ('device rent')"); and then change the value of the corresponding input $ ('# OptID20312026'). Val ('14 ')

Try:

  var labelFor = $ ("label: contains ('device rent')"). Attr ("for" ); $ ("#" +) Force) .val ('14 ');    

Comments