jquery單選框radio綁定click事件實現(xiàn)方法
更新時間:2015年01月14日 15:02:54 投稿:shichen2014
這篇文章主要介紹了jquery單選框radio綁定click事件實現(xiàn)方法,可實現(xiàn)針對單選框radio值的改變作出響應(yīng),非常具有實用價值,需要的朋友可以參考下
本文實例講述了jquery單選框radio綁定click事件實現(xiàn)方法。分享給大家供大家參考。
具體實現(xiàn)方法如下:
復(fù)制代碼 代碼如下:
<html>
<head>
<title>單選框radio綁定click事件</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<script type="text/javascript" src="jquery-1.8.2.min.js"></script>
<script type="text/javascript">
$(function(){
$(":radio").click(function(){
alert("您是..." + $(this).val());
});
});
</script>
<style type="text/css">
h5{color:blue;}
textarea{resize:none;}
#word{color:red;}
</style>
</head>
<body>
<h5>單選框 radio 綁定 click 事件</h5>
<form action="" method="">
<input type="radio" name="gender" value="男性">男性
<input type="radio" name="gender" value="女性">女性
<input type="radio" name="gender" value="春哥">春哥
</form>
</body>
</html>
<head>
<title>單選框radio綁定click事件</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<script type="text/javascript" src="jquery-1.8.2.min.js"></script>
<script type="text/javascript">
$(function(){
$(":radio").click(function(){
alert("您是..." + $(this).val());
});
});
</script>
<style type="text/css">
h5{color:blue;}
textarea{resize:none;}
#word{color:red;}
</style>
</head>
<body>
<h5>單選框 radio 綁定 click 事件</h5>
<form action="" method="">
<input type="radio" name="gender" value="男性">男性
<input type="radio" name="gender" value="女性">女性
<input type="radio" name="gender" value="春哥">春哥
</form>
</body>
</html>
希望本文所述對大家的jQuery程序設(shè)計有所幫助。
相關(guān)文章
jQuery基于cookie實現(xiàn)的購物車實例分析
這篇文章主要介紹了jQuery基于cookie實現(xiàn)購物車的方法,結(jié)合實例形式簡單分析了jQuery基于cookie實現(xiàn)針對商品信息的購物車存儲功能,具有一定參考借鑒價值,需要的朋友可以參考下2015-12-12
基于jQuery實現(xiàn)列表循環(huán)滾動小技巧(超簡單)
只要能夠不停地把第一個item移動到末尾,其余的自會往上填補空缺,填補的過程用動畫放慢些,就能有不斷滾動的視覺效果了,這種效果基于jquery怎么實現(xiàn)呢?下面小編給大家?guī)砹薺Query列表循環(huán)滾動效果的實現(xiàn)思路代碼,一起看看吧2021-08-08
jQuery setTimeout傳遞字符串參數(shù)報錯的解決方法
這篇文章主要介紹了jQuery setTimeout傳遞字符串參數(shù)報錯的解決方法,需要的朋友可以參考下2014-06-06

