I have 3 radio buttons in my web page, like below:(我的网页中有3个单选按钮,如下所示:)
<label for="theme-grey"> <input type="radio" id="theme-grey" name="theme" value="grey" />Grey</label> <label for="theme-pink"> <input type="radio" id="theme-pink" name="theme" value="pink" />Pink</label> <label for="theme-green"> <input type="radio" id="theme-green" name="theme" value="green" />Green</label>
In jQuery, I want to get the value of the selected radio button when any of these three are clicked.(在jQuery中,我想在单击这三个按钮中的任何一个时获取所选单选按钮的值。) In jQuery we have id (#) and class (.) selectors, but what if I want to find a radio button by its name, as below?(在jQuery中,我们具有id(#)和class(。)选择器,但是如果我想按名称查找单选按钮,该怎么办呢?)
$("<radiobutton name attribute>").click(function(){});
Please tell me how to solve this problem.(请告诉我如何解决这个问题。)
ask by Prashant translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…