先給大家分享一篇關于Jquery獲取radio選中的值的實例內容
http://m.survivalescaperooms.com/article/154831.htm
話不多說,請看代碼:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> new document </title> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> <link rel="stylesheet" type="text/css" href="" /> <style type="text/css"></style> <script type="text/javascript" src="jquery-3.0.0.js"></script> </head> <body> <input type="radio" name="radio" value="1" />1<br/> <input type="radio" name="radio" value="2" />2<br/> <input type="radio" name="radio" value="3" />3<br/> <input type="radio" name="radio" value="4" /> <script type="text/javascript"> var a = $("input[name='radio']:checked").val(); alert("選中的radio的值是:" + a);</script> </body></html>以上就是本文的全部內容,希望本文的內容對大家的學習或者工作能帶來一定的幫助,同時也希望多多支持武林網!
新聞熱點
疑難解答