JQuery uses the attr () method to set multiple attribute value usage instances at the same time.
This article mainly introduces jQuery's use of the attr () method to set multiple attribute values at the same time. The example shows the attr method in jQuery to implement multiple attribute settings, which has some reference value, for more information, see
This example describes how jQuery uses the attr () method to set multiple attribute values at the same time. Share it with you for your reference. The details are as follows:
The following example shows how to modify the link and prompt by clicking the button.
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
<! DOCTYPE html> <Html> <Head> <Script src = "js/jquery. min. js"> </Script> <Script> $ (Document). ready (function (){ $ ("Button"). click (function (){ $ ("# W3s"). attr ({ "Href": "http://www.jb51.net/list/list_172_1.htm ", "Title": "jb51.net" }); }); }); </Script> </Head> <Body> <P> <a href = "http://www.jb51.net/list/list_172_1.htm" id = "w3s"> jb51.net </a> </p> <Button> click here to change the link and prompt </button> <P> move the mouse over the link to see that the link and prompt information have been changed. </p> </Body> </Html> |
I hope this article will help you with jQuery programming.