最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

jquery 必填項判斷表單是否為空的方法

 更新時間:2008年09月14日 20:42:33   作者:  
jquery 表單驗證,檢測表單是否為空
html頁面
復(fù)制代碼 代碼如下:

<form onsubmit="if(confirm('確定好你所填寫的正確,不然會發(fā)錯!')) {return checkForm();}else{return false;}" >
<table >
<tr>
<td>選擇發(fā)送人<font class="red">*</font></td>
<td>
<input type="text" name="sendto_type[]" id="sendto_type1" value="1" >按城市發(fā)送

</td>
</tr>

<tr>
<td>選擇發(fā)送人2<font class="red">*</font></td>
<td>
<input type="text" name="sendto_type[]" id="sendto_type1" value="1" >按城市發(fā)送
</td>
</tr>
</table>
</form>

js代碼
復(fù)制代碼 代碼如下:

<script>
function checkForm() {
pass = true;
$("td:contains('*')").next().find("input").each(function(){
if(this.value == '') {
text = $(this).parent().prev().text();
alert(text+"是必填項");
this.focus();
pass = false;
return false;//跳出each
}
});
return pass;
}
</script>

相關(guān)文章

最新評論

金湖县| 高淳县| 鄢陵县| 海原县| 六枝特区| 军事| 梅河口市| 阳谷县| 苏州市| 布尔津县| 新竹县| 平乐县| 炎陵县| 都昌县| 常熟市| 德江县| 芮城县| 清镇市| 云霄县| 平阴县| 河北区| 佛山市| 托里县| 沂南县| 六枝特区| 西丰县| 买车| 北安市| 常宁市| 兴仁县| 秦安县| 克山县| 舒城县| 新田县| 彭山县| 芒康县| 福海县| 萨嘎县| 宁陕县| 青龙| 北宁市|