I have 2 radio buttons and jquery running.
<input type="radio" name="lom" value="1" checked> first
<input type="radio" name="lom" value="2"> second
现在,通过一个按钮,我可以设置onClick来运行一个函数.当我点击其中一个单选按钮时,如何使其运行功能?
I have 2 radio buttons and jquery running.
<input type="radio" name="lom" value="1" checked> first
<input type="radio" name="lom" value="2"> second
现在,通过一个按钮,我可以设置onClick来运行一个函数.当我点击其中一个单选按钮时,如何使其运行功能?
You can use .change
for what you want
$("input[@name='lom']").change(function(){
// Do something interesting here
});
as of jQuery 1.3
you no longer need the '@'. Correct way to select is:
$("input[name='lom']")