Summary of jQuery small test and jQuery Summary
1. The div element contains a <span> element. What is the syntax for getting the <span> element in the <div> element through the has selector? Has () Prompt ()
Answer:$ (Div: has (span) obtains the span tag under the div, rather than the text content under the span tag!
Correct answer: $ ("div span ")
2. In the <ul> element, multiple <li> elements are added, and the method for obtaining the last <li> element through the jquery selector is?
Answer:$ ("Ul li: last ")
3. There are three <div> elements on the page, which are chained in jQuery to hide the second <div> element. What is the code? Hide () Prompt ()
Answer:$ ("Div: eq (1)"). hide ();
4. add multiple <li> elements to the three <ul> elements, and use the child element selector in jQuery, hide the first <li> element in the three <ul> elements. What is the code? Prompt to use first-child
Answer:$ ("Ul: first-child"). hide
5. Multiple <input> type check box elements are added to the form on the page. Some of them are in the selected state. The elements in the selected state are hidden using the jQuery selector. The code is?
Answer:$ ("Form input: checked"). hide ();
6. How can I get the value of the selected element in the list box element? The code is :?
Answer:$ ("Selector option: selected"). val ();
7. Use the attr method to cancel the check box with the ID number "test". The selected status code is :?
Answer:$ ("# Test"). attr ("checked", false)
8. In the three <div> elements, the code for deleting the second element is?
Answer:$ ("Div: Eq (1) "). remove ();
9. How can I remove an event bound to an element? Bind () unbind ();
Answer:Unbind ()
10. How can I use the show method to display a div element whose ID number is test at a speed of 3 seconds?
Answer: $ ('# test'). show (3000 );
11. programming questions
On the page, add a <ul> element with more than seven <li> elements. In addition, add a <a> element.
Initially: only five <li> elements are displayed in the <ul> element, including the last <li> element and "more" characters in the <a> element.
When you click "more", the content becomes "simplified", and all <li> elements are displayed in the <ul> element.
When you click the "simplified" link, the content of the link changes to "more". At the same time, the <ul> element only displays the five elements including the last <li> element.
JQuery section:
<Script type = "text/javascript"> $ (function () {$ (". myclass: visible "). hide (); $ ("a [href = #]"). click (function () {if ($ (this ). text () = "simplified") {$ (". myclass: visible "). hide (); Publish (this).html ("more");} else {$ (". myclass: hidden "). show (); ((this).html ("simplified ");}});});
<Body> part:
<H1> 11th questions