jQuery実装ボタンのクリック全選択/逆選択単選択/チェックボックステキストボックスフォーム検証
4832 ワード
jQuery実装ボタンのクリック全選択/逆選択単選択/チェックボックステキストボックスフォーム検証
年齢:年齢は空にできません!
菜鳥が初めて発表したので、間違いがあれば指摘してください.
以上が本文のすべてですが、お好きになってください.
My JSP 'index.jsp' starting page
$(document).ready(function(){
//
$("#but").click(function(){
alert("This is my JSP page");
});
//
$("#btext").click(function(){
alert($("#te").val());
});
//
$("#sel").change(function(){
alert($("#sel").val());
});
//
$("#uradio1").click(function(){
alert($('input[name="radiobuttid=on"]:checked').val());
});
$("#uradio2").click(function(){
alert($('input[name="radiobutton"]:checked').val());
});
$("#uradio3").click(function(){
alert($('input[name="radiobutton"]:checked').val());
});
//
$("#ucheck").click(function(){
var str="";//
$('input[name="checkbox"]:checked').each(function(){// interest ,
str+=$(this).val();// chk_value
});
alert(str);
});
//
$("#checkall").click(function(){
$("input[name='items']").attr("checked",true);
});
//
$("#checkallNo").click(function(){
$("input[name='items']").attr("checked",false);
});
//
$("#check_revsern").click(function(){
$("input[name='items']").each(function(){
$(this).attr("checked", !$(this).attr("checked"));
});
});
// /
$("#checkItems").click(function(){
$("input[name='items']").attr("checked",$(this).get(0).checked);
});
//
$("#nameid").hide();
$("#ageid").hide();
$("#ubu").click(function(){
if($("#name").val()==""){
$("#nameid").show();
$("#nameid").fadeOut(3000);
return false;
}else if($("#age").val()==""){
$("#ageid").show();
$("#ageid").fadeOut(3000);
return false;
}
alert($("#sel").val());
alert(" :"+$("#name").val()+" "+" "+$("#age").val() );
});
});
1
2
3
1
2
3
4
/
名前:名前を空にすることはできません!年齢:年齢は空にできません!
菜鳥が初めて発表したので、間違いがあれば指摘してください.
以上が本文のすべてですが、お好きになってください.