--------------------------------attr Method------------------------------------------
<! DOCTYPEHTML> <HTMLlang="en"> <Head> <Metacharset="UTF-8"> <title></title> <Scriptsrc=".. /.. /.. /js/jquery-3.1.1.min.js "></Script> </Head> <Body> <inputtype="Text"name="123"value="Eeee"/> </Body> <Script>$(function() {///pass a parameter to get the value of the property//alert ($ (' input '). attr (' name '));
Modify attribute values to pass two parameters//$ (' input '). attr (' name ', ' 321 ');
Alert ($ (' input '). attr (' name '));
$ (' input '). attr (' type ', ' password '); Modify all attribute values of an element//Call the attr method, place all attributes to be modified in {} Between attributes, separating the attribute name from the attribute value separated by a colon$(' input '). attr ({' name ':' 555 ',' type ':' Password ',' value ':' IIIIIIII '}); }) </Script>
</HTML>
-------------------------------------Modify CSS Styles----------------------------------------
<! DOCTYPEHTML> <HTMLlang="en"> <Head> <Metacharset="UTF-8"> <title> Modifying CSS styles with jquery </title> <Scriptsrc=".. /.. /.. /js/jquery-3.1.1.min.js "></Script> </Head> <Body> <Div> Lasdjgha </Div> </Body> <Scripttype="Text/javascript">$(function(){$(' div '). CSS (' Background-color ',' Blue ');$(' div '). CSS ({' Background-color ':' Blue ',' height ':' 200px ',' width ':' 100px '}); }) </Script> </HTML>