国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > HTML > 正文

jQuery設(shè)置和獲取HTML、文本和值示例

2020-03-24 16:02:33
字體:
供稿:網(wǎng)友
$("#address").focus(function(){ // 地址框獲得鼠標(biāo)焦點var txt_html' target='_blank'>value = $(this).val(); // 得到當(dāng)前文本框的值if(txt_value=="請輸入郵箱地址"){ $(this).val(""); // 如果符合條件,則清空文本框內(nèi)容$("#address").blur(function(){ // 地址框失去鼠標(biāo)焦點var txt_value = $(this).val(); // 得到當(dāng)前文本框的值if(txt_value==""){$(this).val("請輸入郵箱地址");// 如果符合條件,則設(shè)置內(nèi)容$("#password").focus(function(){var txt_value = $(this).val();if(txt_value=="請輸入郵箱密碼"){$(this).val("");$("#password").blur(function(){var txt_value = $(this).val();if(txt_value==""){$(this).val("請輸入郵箱密碼");//]] /script
script type="text/javascript" // ![CDATA[ $(function(){ $("#address").focus(function(){ // 地址框獲得鼠標(biāo)焦點 var txt_value = $(this).val(); // 得到當(dāng)前文本框的值 if(txt_value==this.defaultValue){ $(this).val(""); // 如果符合條件,則清空文本框內(nèi)容 } }); $("#address").blur(function(){ // 地址框失去鼠標(biāo)焦點 var txt_value = $(this).val(); // 得到當(dāng)前文本框的值 if(txt_value==""){ $(this).val(this.defaultValue);// 如果符合條件,則設(shè)置內(nèi)容 } })$("#password").focus(function(){var txt_value = $(this).val();if(txt_value==this.defaultValue){$(this).val("");$("#password").blur(function(){var txt_value = $(this).val();if(txt_value==""){$(this).val(this.defaultValue);//]] /script
$("input:eq(0)").click(function(){$("#single option").removeAttr("selected"); //移除屬性selected$("#single option:eq(1)").attr("selected",true); //設(shè)置屬性selected//設(shè)置多選下拉框選中$("input:eq(1)").click(function(){$("#multiple option").removeAttr("selected"); //移除屬性selected$("#multiple option:eq(2)").attr("selected",true);//設(shè)置屬性selected$("#multiple option:eq(3)").attr("selected",true);//設(shè)置屬性selected//設(shè)置單選框和多選框選中$("input:eq(2)").click(function(){$(":checkbox").removeAttr("checked"); //移除屬性checked$(":radio").removeAttr("checked"); //移除屬性checked$(":checkbox[value=check2]").attr("checked",true);//設(shè)置屬性checked$("[value=check3]:checkbox").attr("checked",true);//設(shè)置屬性checked$("[value=radio2]:radio").attr("checked",true);//設(shè)置屬性checked//]] /script :checkbox 表示屬性為checkbox更多編程語言

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請第一時間聯(lián)系我們修改或刪除,多謝。

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 合川市| 敦化市| 吴旗县| 新蔡县| 依安县| 黑水县| 诏安县| 南陵县| 建阳市| 郑州市| 镇江市| 临泉县| 山西省| 巴林左旗| 治县。| 金华市| 新民市| 定陶县| 古丈县| 万全县| 开平市| 海兴县| 寿宁县| 灌阳县| 邳州市| 双牌县| 米泉市| 奈曼旗| 松江区| 诏安县| 常山县| 克什克腾旗| 肇东市| 崇礼县| 罗定市| 宜兴市| 靖安县| 贵港市| 灵台县| 长岭县| 六盘水市|