JQuery Selector-2

Source: Internet
Author: User
Tags compact

Continue on to an article

Next is the form selector


Form Object Properties Filter Selector

Or do you want to write a form page as a sample

<! DOCTYPE html>  


The preview results are as follows:




If we write the jquery code as follows

$ ("#form1 input:enabled"). Val ("Here's the change.") ");

Then his role will be as follows, all enabled settings of the input field content, has been changed.





Modify jquery again as follows

$ ("#form1 input:disabled"). Val ("There's been a change here.") ");

Input form fields for all disabled properties are modified






form selector




actual Operation

Use a website similar to the electronic business to do the actual operation

 


The basic effect is as follows




Main objectives:

1: Make a button, you can let the above list for all/part of the switch between the display, but the other brand camera several words must be retained

2: In the partial display case, let the specified brand highlight


$ (function () {var $category = $ (' ul li:gt (5): Not (: last) ');                                     Select the 6th to the 2nd of the list cell, without the last $category. Hide ();               Hide operations on selected objects var $toggleBtn = $ (' Div.showmore > A '); Select the a element in the div named ShowMore $toggleBtn. Click (function () {//Add the Click event for this hyperlink ($cate                     Gory.is (": Visible")) {//If the category element is visible $category. Hide ();
            Hide operations on category $ ('. ShowMore a span '). CSS ("Background", "url (./img/down.gif) no-repeat 0 0"). Text ("Show All Brands");
            And the class for showmore within the text, add a background picture, and the text will be modified to display all the brand $ (' ul Li '). Removeclass ("promoted");           Remove the promoted class name of each list element, promoted this class name is a CSS}else{$category that lets text display highlights. Show (); Conversely, the category is adjusted to show state $ ('. ShowMore a span '). CSS ("Background", "url (./img/up.gif) no-repeat 0 0"). Text ("Compact display brand"
            ); The background picture is modified and the text is changed to a compact display brand $ (' ul Li '). filtER (": Contains (' Canon '),: Contains (' Nikon '),: Contains (' Olympus ')"). AddClass ("promoted");  and filter all the list elements, select the specified brand, add class name promoted} return false; return false is to otherwise hyperlink open new Page});


The effect of execution is as follows







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.