Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have 2 radio buttons and jquery running.(我有2个单选按钮和jquery运行。)

<input type="radio" name="lom" value="1" checked> first <input type="radio" name="lom" value="2"> second Now, with a button I can set onClick to run a function.(现在,使用按钮我可以设置onClick来运行一个功能。) What is the way to make radio buttons run a function when I click on one of them?(当我点击其中一个时,单选按钮运行功能的方法是什么?)   ask by David19801 translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
224 views
Welcome To Ask or Share your Answers For Others

1 Answer

You can use .change for what you want(您可以根据需要使用.change)

$("input[@name='lom']").change(function(){ // Do something interesting here }); as of jQuery 1.3(从jQuery 1.3开始) you no longer need the '@'.(你不再需要'@'。) Correct way to select is:(正确的选择方式是:) $("input[name='lom']")

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...