jquery css ()

Source: Internet
Author: User

CSS () jquery changes Dom property method, () put {} object inside

The following code:

<div id= "Text" ></div>

<p> Click the button to change the background </p>
<button class= "BTN" > Exchange </button>

Style ()

#text {width:50rem;height:20rem; Background:url (' images/b3.jpg ') no-repeat;}

Js

$ (document). Ready (function () {$ (". Btn"). Click (function () {$ ("#text"). CSS ({"Background": "url (' Images/3.jpeg ') Repeat "}) $ (" #text "). CSS ({" width ":" 40rem "," height ":" 40rem "})})

Summary: CSS () sets property values inside a style

(Ps:attr () Gets or sets a property value of an element when the value of the property is set so that the value of the function

Obj.attr ("title", function () {return this.alt});
Alert ($ ("ul Li:eq (1)"). attr ("title")); )

jquery css ()

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.