jquery attribute name modification

jquery   attr

. 1  < Script > 
2  
. 3      // Get class name 
. 4      $ ( " .box " ) .attr ( " class " )
 . 5      
. 6      // modify or add class name, there are (pick-class) is modified, no (pick-id ) is to add 
7      $ ( " #box " ) .attr ( " class " , " Men " )
 8       
9      // remove the class attribute 
10      $ ( " #box " ) .removeAttr ( " class ")
11     
12      // add class name 
13 is      $ ( " #box " ) .addClass ( " REN " )
 14      
15      // remove the class name 
16      $ ( " #box " ) .removeClass ( " REN " )
 . 17      
18 is      // have changed class name to be removed, there is no class name that is added 
. 19      $ ( " #box " ) .toggleClass ( ' REN ' )
 20 is      
21 is      // Get content input box () 
22 is      var SS = $ ( 'input[name="yier"]').val()
23 </script>

 

Guess you like

Origin www.cnblogs.com/xiaoyaolang/p/11895847.html