jquery單選框radio綁定click事件實(shí)現(xiàn)方法
更新時(shí)間:2015年01月14日 15:02:54 投稿:shichen2014
這篇文章主要介紹了jquery單選框radio綁定click事件實(shí)現(xiàn)方法,可實(shí)現(xiàn)針對單選框radio值的改變作出響應(yīng),非常具有實(shí)用價(jià)值,需要的朋友可以參考下
本文實(shí)例講述了jquery單選框radio綁定click事件實(shí)現(xiàn)方法。分享給大家供大家參考。
具體實(shí)現(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è)計(jì)有所幫助。
您可能感興趣的文章:
相關(guān)文章
基于JSON格式數(shù)據(jù)的簡單jQuery幻燈片插件(jquery-slider)
jquery-slider幻燈片插件通過json數(shù)據(jù)來提供圖片地址和描述信息,同時(shí)也可以更換json數(shù)據(jù)來動態(tài)切換不同的圖片,對json數(shù)據(jù)jquery幻燈片插件相關(guān)知識感興趣的朋友一起學(xué)習(xí)吧2016-08-08artDialog 4.1.5 Dreamweaver代碼提示/補(bǔ)全插件 附下載
artDialog是一個輕巧且高度兼容的javascript對話框組件,可讓你的網(wǎng)頁交互擁有桌面軟件般的用戶體驗(yàn)2012-07-07如何使用jquery動態(tài)加載js,css文件實(shí)現(xiàn)代碼
在jquery中要實(shí)現(xiàn)動態(tài)加載js文件的方法有很多種,最簡單的我們可以直接利用$.include()方法來實(shí)現(xiàn),感興趣的朋友可以參考下哈2013-04-04jQuery插件開發(fā)精品教程(讓你的jQuery更上一個臺階)
這篇jQuery插件開發(fā)教程是小編見過的最詳細(xì)的了,每個解說都很好,對于想做增強(qiáng)插件的朋友確實(shí)不錯的參考資料,特分享下,方便需要的朋友2015-11-1160個很實(shí)用的jQuery代碼開發(fā)技巧收集
這篇文章主要介紹了60個很實(shí)用的jQuery代碼開發(fā)技巧收集,使用jquery的朋友可以參考下核心代碼的使用,需要的朋友可以參考下2014-12-12