How to get rid of attribute values in html
This article is about how to remove attribute values from html. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Html to remove the attribute value of the method: 1, use the attr () method to set the specified attribute value to an empty string, syntax "$(element). Attr (" attribute name ",") "; 2, use the removeAttr () method to remove the specified attribute, syntax" $(element). RemoveAttr ("attribute name") ".
The operating environment of this tutorial: windows7 system, jquery1.10.2&&HTML5 version, Dell G3 computer.
Remove attribute values from html
1. Use the attr () method to set the specified attribute value to an empty string
$(document) .ready (function () {$("button") .click (function () {$("img"). Attr ("width", ");})
Remove the width attribute value
2. Use the removeAttr () method to remove the specified attribute
$(document) .ready (function () {$("button") .click (function () {$("img"). RemoveAttr ("width");})
Remove width attribut
Thank you for reading! This is the end of the article on "how to remove attribute values in html". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!