How to modify css by id in jquery
Jul 26, 2021 pm 02:43 PMIn jquery, you can use the "[att^=element]" selector to match elements starting with a certain id, and then use the css method to return or set one or more style attributes of the matched element, syntax format is "$(element).css(attribute, attribute value)".
The operating environment of this tutorial: Windows 7 system, jquery version 1.11.1, Dell G3 computer.
<ul id="foreignCurrencyTree_1_ul"> <li id="foreignCurrencyTree_11_li">111111</li> <li id="foreignCurrencyTree_12_li">222222</li> <li id="foreignCurrencyTree_13_li">333333</li> </ul> <ul id="foreignCurrencyTree_2_ul"> <li id="foreignCurrencyTree_21_li">111111</li> <li id="foreignCurrencyTree_22_li">222222</li> <li id="foreignCurrencyTree_23_li">333333</li> </ul>
# Sets the specified CSS property for all matching elements.
$(selector).css(name,value)
//设置所有ul的overflow属性为hidden。 $('[id^=foreignCurrencyTree_][id$=_ul]').css("overflow","hidden"); //设置所有li的display属性为inline $('[id^=foreignCurrencyTree_][id$=_li]').css("display","inline");
[Recommended learning: javascript advanced tutorial]
The above is the detailed content of How to modify css by id in jquery. For more information, please follow other related articles on the PHP Chinese website!

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Detailed explanation of jQuery reference methods: Quick start guide

How to use PUT request method in jQuery?

How to remove the height attribute of an element with jQuery?

jQuery Tips: Quickly modify the text of all a tags on the page

Use jQuery to modify the text content of all a tags

In-depth analysis: jQuery's advantages and disadvantages

Understand the role and application scenarios of eq in jQuery

How to tell if a jQuery element has a specific attribute?
