Learn how to use jquery to write some small code today, try writing a textarea, the code is as follows:
The effect chart is as follows:
Can be zoomed in and out, which is the advantage of the jquery effect.
One more input tag, code:
The effect chart is as follows:
Add a focus and lose focus, default value, and then set a background color to get focus
The third one, wrote a Select, this thing generally in the QQ space and Taobao used more widely, so also more interested in the code as follows:
The effect chart is as follows:
Move the option on the left to the right, and double-click to add more, haha, write code is very interesting,
Operation checkbox
Html
<a href= "javascript:;" id= "All" > All options </a><br>
<a href= "javascript:;" id= "Delall" > Deselect </a><br>
<a href= "javascript:;" id= "Antiall" > Reverse selection </a>
<p><input type= " CheckBox "Name=" CheckBox1 ">a
<input type=" checkbox "Name=" CheckBox1 "> B
<input type=" checkbox " Name= "CheckBox1" >C</p>
<p><input type= "checkbox" Name= "CheckBox1" >d <input "type="
CheckBox "Name=" CheckBox1 ">e
<input type=" checkbox "Name=" CheckBox1 ">F</p>
jquery section
Select All
$ ("#all"). Click (function () {
$ (' input[name= ' CheckBox1 ']). each (function () {
$ (this). attr (" Checked ", true);
});
Ordinary Javascirpt part:
function Checkall () {for
(i=0;i<newtask.length;i++) {
e=newtask.elements[i];
if (e.type== ' checkbox ') {
if (e.checked=false) {
e.checked=true
} else{
e.checked=true
}}
}
Deselect code:
jquery section:
Deselect
$ ("#delAll"). Click (function () {
$ ("Input[name= ' CheckBox1 ')"). each (function () {
$ (this). attr ("Checked", false);
});
Common JavaScript section:
function Delall () {for
(i=0;i<newtask.length;i++) {
e=newtask.elements[i];
if (e.type== ' checkbox ') {
if (e.checked=true) {
e.checked=false
}
else{
e.checked=false
}}
}
Reverse Select Code:
jquery section:
Reverse Select
$ ("#antiAll"). Click (function () {
$ ("Input[name= ' CheckBox1 ')"). each (function () {
$ (this). attr ( "Checked",!this.checked);
Common JavaScript section:
function Antiall () {for
(i=0;i<newtask.length;i++) {
e=newtask.elements[i];
if (e.type== ' checkbox ') {e.checked=!e.checked}}}