Use jquery and CSS to create personalized single quotes and check boxes

Source: Internet
Author: User


What is the effect after CSS and jquery beautification? Isn't that refreshing! This is an effect I saw from another script library. I thought it was quite good, and then I implemented it myself using jquery. For your appreciation!
Let's just talk about it. Code : Copy code The Code is as follows: <! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Title> Create a personalized single region and check box </title>
<Style type = "text/CSS">
*
{
Margin: 0;
Padding: 0;
Font-size: 12px;
}
. Formt
{
Width: 400px;
Margin: 10px auto;
Border: 1px solid # CCC;
Height: 200px;
Padding: 10px;
}
. Unselected
{
Background-image: url(rdo_off.png );
}
. Selected
{
Background-image: url(rdo_on.png );
}
. Unchecked
{
Background-image: url(chk_off.png );
}
. Checked
{
Background-image: url(chk_on.png );
}
. F_checkbox,. f_radio
{
Background-position: 3px center;
Background-repeat: No-Repeat;
Cursor: pointer;
Display: block;
Height: 16px;
Line-Height: 120%;
Padding: 4px 24px;
}
. Formt Input
{
Left:-9999px;
Position: absolute;
}
. Addcolor
{
Color: red;
}
</Style>
<SCRIPT type = "text/JavaScript" src = "jquery-1.4.2.min.js"> </SCRIPT>
<SCRIPT type = "text/JavaScript">
$ (
Function (){
// Single answer
$ (". F_radio"). Click (
Function (){
$ (This ). addclass ("selected "). removeclass ("unselected "). siblings (". selected "). removeclass ("selected "). addclass ("unselected ");
}
);
// Check
$ (". F_checkbox"). Toggle (
Function (){
$ (This). addclass ("checked ");
$ (This). Children ("input"). ATTR ("checked", "checked ");
},
Function (){
$ (This). removeclass ("checked ");
$ (This). Children ("input"). removeattr ("checked ");
}
);
}
);
</SCRIPT>
</Head>
<Body>
<Div class = "formt">
<Label class = "f_radio unselected">
<Input type = 'Radio 'name = "height" value = "dwarf"/>
Standard online tax administration </label>
<Label class = "f_radio unselected">
<Input type = "radio" name = "height" value = "average"/>
Online Tax Return Professional Edition </label>
<Label class = "f_radio unselected">
<Input type = "radio" name = "height" value = "Giant"/>
Others </label>
<HR/>
<Label class = "f_checkbox unchecked">
<Input type = "checkbox" name = "newsletter" value = "C" id = "C"/>
Invoice authentication </label>
<Label class = "f_checkbox unchecked">
<Input type = "checkbox" name = "newsletter" value = "D" id = "D"/>
Tax-related authentication </label>
</Div>
<Label for = "male">
Male </label>
<Input type = "checkbox" name = "sex" id = "male"/>
</Body>
</Html>

Pictures can be taken by yourself.

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.