jquery to implement button clicks

Source: Internet
Author: User
Tags empty

This article mainly introduces the jquery implementation button click Select/Reverse menu box/check box text box verification of the relevant information, the need for friends can refer to the following

jquery Implementation button Click Select/Reverse menu checkbox/CheckBox text Box form validation

?

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26-27--28 29---30 31--32 33 34 35 36 37 38-39 40 41 42 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 5, 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 11 9 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145-146 <! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" > <html> <head> <base href= "<%=basepath %> ">   <title>my JSP ' index.jsp ' starting page</title> <meta http-equiv= ' pragma ' content= ' No-cache "> <meta http-equiv=" Cache-control "content=" No-cache "> <meta http-equiv=" Expires "content=" 0 " > <meta http-equiv= "keywords" content= "keyword1,keyword2,keyword3" > <meta http-equiv= "description" Content= "This are my page" > <!--<link rel= "stylesheet" type= "Text/css" href= "Styles.css" >--> <script t Ype= "Text/javascript" src= "jquery-1.4.js" ></script> <script type= "Text/javascript" > $ (document). Ready (function () {//button $ ("#but"). Click (function () {alert ("This is my JSP page");  //text box $ ("#btext"). Click (funct Ion () {Alert ($ ("#te"). Val ());  /Drop-down Box $ ("#sel"). Change (function () {Alert ($ ("#sel"). Val ());  //Radio Box $ ("#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 ());  //check box $ ("#ucheck"). Click (function () {var str= "";//define an array $ (' input[name= checkbox ']:checked '). each (function () {//Traverse each interest checkbox with the selected execution function str+=$ (this). Val (), add the selected value to the array chk_value  }); alert (str); }); Select All $ ("#checkall"). Click (function () {$ ("input[name= ' items ']"). attr ("Checked", true);  /All Optional $ ("#checkallNo"). Click (function () {$ ("input[name= ' items ']"). attr ("checked", false);});  /Reverse $ ("#check_revsern"). Click (function () {$ ("input[name= ' items ']"). each (function () {$ (this). attr ("Checked" ,!$ (This). attr ("checked")); }); });  //Select all/Reverse Select $ ("#checkItems"). Click (function () {$ ("input[name= ' items ']"). attr ("Checked", $ (This). (0). Checked) ; });  /form Validation $ ("#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:" +$ ("#name"). Val () + "" + "Age" +$ ("#age"). Val ()); });  }); </script> </head>   <body> <!--button--> <input type= "button" value= "Confirm" id= "but"/>< Br>   <!--text box--> <input type= "text" name= "text" id= "TE"/><input type= "button" id= "Btext" value= " Take value "><br>   <!--dropdown box--> <select id=" sel "> <option value=" 1 ">1</option> <option Value= "2" >2</option> <option value= "3" >3</option> </select> <br>   <!--Radio Box- -> <input type= "Radio" name= "RadioButton" id= "Uradio1" value= "1" > 1 <input type= "Radio" name= "RadioButton" Id= "Uradio2" value= "2" > 2 <input type= "Radio" name= "RadioButton" id= "Uradio3" value= "3" > 3 <br>   ;! --check box--> <input type= "checkbox" name= "checkbox" value= "1" > 1 <input type= "checkbox" name= "checkbox" value= "2" > 2 <input type= "checkbox" name= "checkbox" value= "3" > 3 <input type= "checkbox" name= "checkbox" value= "4" > 4 <input type= " Button "id=" Ucheck "value=" OK "> <br>   <!--check box selection and reverse--> <input type=" checkbox "Name=" Checkitems " "Id=" Checkitems "value=" all Select/all do not select "/> All/no choice <br> <input type=" checkbox "name=" Items "value=" Football "/> Football < Input type= "checkbox" name= "items" value= "basketball"/> Basketball <input type= "checkbox" name= "items" value= "swimming"/> Swimming < Input type= "checkbox" name= "items" value= "singing"/> Singing <br> <input type= "button" Name= "Checkall" id= "Checkall" Value= "Select All"/> <input type= "button" Name= "Checkall" id= "Checkallno" value= "All do not select"/> <input "button" type= "Checkall" id= "Check_revsern" value= "/>   <!--form verification--> <form action=" "> Name: <input type=" Text " Id= "name" ><span id= "NameID" style= "color: #f00;"> name cannot be empty! </span><br> Ages: <input type= "text" id= "age"/><span id= "Ageid" color: #f00; > Age can not be empty! </span> <br> <input type= "button" id= "Ubu" value= "OK"/> </form> </body> </html> & nbsp

Rookie first release, if there is a wrong also hope to point out

The above mentioned is the entire content of this article, I hope you can enjoy.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.