Code for beautifying the checkbox and radio controls using jquery and images (package and download)

Source: Internet
Author: User

:
 
HTML:
Copy codeThe Code is as follows:
<Div id = "chklist" style = "padding: 10px; font-size: 14px;">
<Input type = "checkbox" value = '1'/> <label> aaaaaa </label>
<Input type = "checkbox" value = '2'/> <label> bbbbbb </label>
<Input type = "checkbox" value = '3'/> <label> ccccc </label>
<Input type = "checkbox" value = '4'/> <label> ddddd </label>
</Div>
<Div id = "radiolist" style = "padding: 10px; font-size: 14px;">
<Input name = 'R' type = "radio" value = '11'/> <label> AAAAAA </label>
<Input name = 'R' type = "radio" value = '21'/> <label> BBBBBBBB </label>
<Input name = 'R' type = "radio" value = '31'/> <label> CCCCCC </label>
<Input name = 'r'type = "radio" value = '41'/> <label> DDDDDD </label>
</Div>


JS:
Copy codeThe Code is as follows:
$ (Function (){
$ ('# Chklist'). hcheckbox ();
$ ('# Radiolist'). hradio ();
$ ('# BtnOK'). click (function (){
Var checkedValues = new Array ();
$ ('# Chklist: checkbox'). each (function (){
If ($ (this). is (': checked '))
{
CheckedValues. push ($ (this). val ());
}
});
Alert (checkedValues. join (','));
Alert ($ ('# radiolist: checked'). val ());
})
});

It is required to introduce jquery files.
There is also a checkbox plug-in JS file jquery-hcheckbox.js, In the download of the compressed package has the source file and DEMO
Please let me know if you have made more beautiful on this basis ~~
Demo address http://demo.jb51.net/js/jQuery_HCheckbox/index.html
Package

Related Article

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.