jquery Operation Basic Selector

Source: Internet
Author: User

<Body>        <inputtype= "button"ID= "BTN1"value= "element selected as one"/>        <inputtype= "button"ID= "BTN2"value= "SELECT element with style mini"/>        <inputtype= "button"ID= "Btn3"value= "Select all div elements"/>        <inputtype= "button"ID= "Btn4"value= "Select all elements"/>        <inputtype= "button"ID= "Btn5"value= "Select an element with ID of both and the style is Mini"/>        <HR/>        <DivID= "One">            <Divclass= "Mini">111</Div>        </Div>                <DivID= "both">            <Divclass= "Mini">222</Div>            <Divclass= "Mini">333</Div>        </Div>                <DivID= "three">            <Divclass= "Mini">444</Div>            <Divclass= "Mini">555</Div>            <Divclass= "Mini">666</Div>        </Div>                <spanID= "Four">                    </span>    </Body>

Style.css

Body {font:12px/19px Arial, Helvetica, sans-serif; color: #666;} Form Div {margin:5px 0;}. int label {float:left; width:100px; text-align:right;}. int input {padding:1px 1px; border:1px solid #ccc; height:16px;}. Sub {padding-left:100px;}. Sub input {margin-right:10px;}. formtips{width:200px;margin:2px;padding:2px;}. onerror{background: #FFE0E9 URL (..    /img/reg3.gif) no-repeat 0 Center; padding-left:25px;}. onsuccess{background: #E9FBEB URL (..    /img/reg4.gif) no-repeat 0 Center; padding-left:25px;}.  high{color:red;}    div,span,p {width:140px;    height:140px;    margin:5px;    Background: #aaa;    border: #000 1px solid;    Float:left;    font-size:17px;  Font-family:verdana;    } div.mini {width:55px;    height:55px;    Background-color: #aaa;  font-size:12px;  } div.hide {display:none; }table {border:0;border-collapse:collapse;} TD {Font:normal 12px/17px arial;padding:2px;width:100px;} th {font:bold 12px/17px Arial;text-align:left;padding:4px;border-bottom:1px solid #333;}.  Even {background: #FFF38F;}  /* Even line style */.odd {background: #FFFFEE;} /* Odd line style */.selected {background: #FF6500; color: #fff;}

JS Code

<Head>        <MetaCharSet= "UTF-8">        <title>Basic Selector</title>        <<linkrel= "stylesheet"type= "Text/css"href=".. /.. /css/style.css "/>        <Scriptsrc=".. /.. /js/jquery-1.8.3.js "></Script>        <Script>            $(function(){                $("#btn1"). Click (function(){                    $("#one"). CSS ("Background-color","Pink");                                }); $("#btn2"). Click (function(){                    $(". Mini"). CSS ("Background-color","Pink"); })                                $("#btn3"). Click (function(){                    $("Div"). CSS ("Background-color","Pink"); })                                $("#btn4"). Click (function(){                    $("*"). CSS ("Background-color","Pink")                })                                $("#btn5"). Click (function(){                    $("#two, Mini"). CSS ("Background-color","Pink")                })            })        </Script>    </Head>

jquery Operation Basic Selector

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.