Zhang Ying published in 2013-07-16Category: Js/jqueryTags: checkbox, jquery, Radio, checkedjquery is flexible, there are many ways to check the checkbox radio tag, and here are just a few examples of three common methods.One, test the HTMLView copy print?
div style="margin-top:150px;" >
input Type= '
You can't write this directly in HTML:
The code is as follows
Copy Code
Generally, the above code is checked with HTML default. But if you use jquery Ajax to submit the form, whether you check it or not, it will be submitted. Because your judgment is not allowed.
The code is as follows
Copy Code
if (checkbox.attr (' checked ')) {}
For example, the above judgment, even if yo
JQuery implements the all-selected and all-unselected functions of CheckBox, jquerycheckbox
If you don't talk much about it, paste the Code directly. The specific code is as follows:
JQuery version Problems
The original operation property uses $("XXX").attr("attrName");
JQuery uses version 2.1.1, which is a problem of
Tag:button Get Disable javascrip code by ID octmin Cancel check 1//NOTE: When operating the Checked,disabled property of a CheckBox jquery1.6 previous version with attr,1.6 above (included) is recommended Prop 2 3//1, get a checkbox by ID 4 $ ("#cbChec Kbox1 "); 5 6//2, get all checkboxes 7 $ ("Input[type= ' checkbox
1, CheckBox daily jquery operation. Now let's take the following HTML as an example of the checkbox operation.
Select All and select All code:
CheckBox Properties:
var val = $ ("#checkAll"). Val ()///Get the value of the checkbox for the s
1. Get a single checkbox check (three ways)$ ("input:checkbox:checked"). Val ()Or$ ("input:[type= ' checkbox ']:checked"). Val ();Or$ ("input:[name= ' ck ']:checked"). Val ();2. Get multiple checkbox check items$ (' Input:checkbox '). each (function () {if ($ (this). attr ('
Jquery captures the Enter key and obtains the checkbox value and the asynchronous request method,
This document describes how jquery captures the Enter key and obtains the checkbox value and asynchronous request. We will share this with you for your reference. The details are as follows:
1.
the largest option (last) index value in select)4. $ ("# select_id option [Index = '0']"). Remove (); // Delete the option with the index value 0 in select (the first option)5. $ ("# select_id option [value = '3']"). Remove (); // Delete the option with value = '3' In the SELECT statement6. $ ("# select_id option [TEXT = '4']"). Remove (); // Delete the option of '4' text = '4' in select
7. $ ("# selectid"). Remove (); // delete all items
Ii. checkbox
The jQuery operation check box (checkbox) attr checked does not work, jqueryattrJQuery changes the checkbox status, which is invalid.
$ (This). attr ("checked", false). checkboxradio ("refresh"); // It should be written in this way. It's missing $ this stuff ~~~ Confused with jsThe jQuery operation check box (
Jquery. jcheckbox is a simulated checkbox plug-in developed based on jquery. *. It can display more beautiful UI effects in any system environment.
:
You can download the source code here: jquery. jcheckbox. js
Very small and easy to use:
Code highlighting produced by Actipro CodeHighlighter (freeware)http://
attributes module was to remove ambiguities between the attributes and properties, but it caused some confusion in the jquery community because one method was used in all versions prior to 1.6 (. attr ()) To deal with attributes and properties. But the old. attr () method has some bugs that are difficult to maintain. jQuery1.6.1 has updated the Attributes module and fixed several bugs.In particular, the Boolean attributes, such as: checked,selected,r
:
Syntax explanation:
1. $ ("# select_id"). append (" // Append an option to select (drop-down)
2. $ ("# select_id"). prepend (" // Insert an option for select (first position)
3. $ ("# select_id option: Last"). Remove ();
// Delete the largest option (last) of the index values in the SELECT statement)
4. $ ("# select_id option [Index = '0']"). Remove ();
// Delete the option with the index value 0 in the SELECT statement (first)
5. $ ("# select_id option [value = '3']"). Remove ();
// Del
Using the jquery array, you can store all the checkbox values. The following is a good example. For more information, see
The Code is as follows:
Select All/select none1234 Script$ ("# ChekcAll"). click (function (){If (this. checked ){$ ("Input [name = items]"). attr ("checked", "checked ");}Else {$ ("Input [name
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.