Official jQuery website

Source: Internet
Author: User

Official jQuery website

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 ()

 

$ ("Div: has (span )");

1. added multiple <li> elements to the <ul> element. Which of the following methods can be used to obtain the last <li> element through the jquery selector?

 

$ ("Ul li: last ");

 

2. 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 ()

$ ("Div: eq (1)"). hide ();

 

3. 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

 

$ ("Li: first-child") hide ()

 

4. 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?

 

$ ("Form input: checked"). hide ();

 

5. How can I get the value of the selected element in the list box element? The code is :?

$ ("Select option: selected"). text ()

 

 

6. Use the attr method to cancel the check box with the ID number "test". The selected status code is :?

 

$ ("# Test"). attr ("checked", false );

 

 

 

7. In the three <div> elements, the code for deleting the second element is?

 

$ ("Div: eq (1)"). remove ();

8. How can I remove an event bound to an element? Bind () unbind ();

 

Unbind ();

 

9. How can I use the show method to display a div element whose ID number is test at a speed of 3 seconds?

 

 

$ ('# Test'). show (3000 );

 

 

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.

 

<Ul>
<Li> digital baby </li>
<Li> armor warrior </li>
<Li> death day of the armor warrior </li>
<Li class = "myclass"> Pokémon </li>
<Li class = "myclass"> Xiao li feidao </li>
<Li class = "myclass"> fall in love with you </li>
</Ul>
<A href = "#" onclick = "my_ran ()"> more </a>

 

$ (Function (){
$ (". Myclass: visible"). hide ();

$ ("A [href = #]"). click (function (){
If ($ (this). text () = "simplified "){
$ (". Myclass: visible"). hide ();
Certificate (this).html ("more ");
} Else {
$ (". Myclass: hidden"). show ();
Certificate (this).html ("simplified ");
}
});
});

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.