Selector 01 and jquery selector 01 in jquery
<! Doctype html>
<Html>
<Head>
<Meta charset = "gb2312">
<Title> ministerial exercise jqurey </title>
<Script src = "js/jquery-1.11.1.min.js"> </script>
<Script>
$ (Document). ready (function (e ){
// Select the div whose id is contained in the div tag
(('Div?id='{.css ('font-size', '50px ');
// Select the div of class = aa in the div label
('Div?class=aa}'{.html ('20140901 ');
// Select class = div whose name begins with nav-in the div label.
('Div?class==nav-{'}.css ('color', 'red ');
});
</Script>
</Head>
<Body>
<Div id = "ddd"> hello </div>
<Hr>
<Div id = "myd2"> header-div </div>
<Hr>
<Div class = "aa"> OK </div>
<Div class = "aa"> ff </div>
<Hr>
<Div class = "nav-left"> menu1 </div>
<Div class = "nav-right"> menu1 </div>
<Div class = "nav-center"> menu1 </div>
<Div class = "OK-nav"> menu1 </div>
</Body>
</Html>
Webpage effect:
Matching Problem of jquery selector attributes before href
$ ("A [href = 'javascript: node_onselect (" 01 "using '{}}.html ()
That's all ~
Question about jquery: How can I obtain the id of a selector through a variable? For example, I want jquery to obtain # sel01, # sel02, # sel03
When I looked at the CSS 3.0 api, I found that p [title ^ = "val"] {color: # FF0000;} has a selector that matches the start string of the element of the TITLE of the P tag, then I tried JQUERY and found that it was okay.
The main code is $ ("tr [id ^ = 'myte']" ).css ("background-color", "# B2E400 ");
It means matching tr whose id starts with myte. As a result, the color of tr whose id starts with myte is changed. You can try it. The advantage of JQUERY is that it is possible not to use loops as much as possible. Later I thought that if I was not sure which tag was used, I would remove TR, I can even change TR to $.
$ ("[Id ^ = 'myte']" ).css ("background-color", "# B2E400"); add several divs to the page, the background color of div and TR can be changed.
But does JQUERY have the mouseenter and mouseleave events?
You can try the following code:
$ (Document). ready (function (){
$ ("[Id ^ = 'sel ']"). mouseout (function () {// move the mouse away
$ (". Child_menus"). hide ("slow ");
}
);
$ ("[Id ^ = 'sel0']"). mouseover (function () {// hover the mouse over
$ (". Child_menus"). show ("slow"); //. It is a class selector.
}
);});
I tried it. Yes.
I have to say that JQUERY's selector is really powerful.
References: CSS3.0 Reference Manual