CSS attributes of element properties in jquery

Source: Internet
Author: User

Dynamically modify the src attribute of the IMG label and use each

<P> </P> <br/> <p> </P> <br/> <p> </P> <br/> <p> </ p> 

 

<MCE: Script Type = "text/JavaScript"> <! -- <Br/> $ (". google "). each (function () {<br/> This. src = "http://www.baidu.com/img/baidu_sylogo1.gif"; <br/>}); <br/> // --> </MCE: SCRIPT> 

 

Use the ATTR () method

VaR IMG = $ ("# ID"); <br/> obtain the src attribute <br/> IMG. ATTR ("src"); <br/> set the src attribute <br/> IMG. ATTR ("src", "http://www.google.com "); 

Change multiple attributes at a time

$ ("# Google1"). ATTR ({SRC: 'http: // www.baidu.com/img/baidu_sylogo1.gif', title:'titlepolicheere '}) 

Delete the attribute and use removeattr ("name ")

 

Use attributes to avoid multiple submissions

$ ("# Form "). submit (function () {<br/> $ (": Submit", this ). ATTR ("disabled", "Disable"); <br/> }); 

 

Add class

Addclass ()

Delete class

Removeclass ()

 

Get CSS attributes

CSS ()

Alert ($ ("# google1" ).css ("display"); <br/> $ ("# google1" ).css ("display", "NONE ") 

 

Determine whether an element has a class

Hasclass ()

 

 

HTML ()

Returns the HTML content of the first element in the matching set.

 

HTML (content)

Set content in all matching sets

 

The text () method is similar to HTML ()

Add append

Add to the specified node appendto ();

 

Remove ()

Clone ()

 

Returns the value of the form element, Val

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.