YouTip LogoYouTip

Met Element Setattribute

# HTML DOM setAttribute() Method [![Image 8: Element Object Reference Manual](#) Element Object](#) ## Example Set the type attribute of an input element: document.getElementsByTagName("INPUT").setAttribute("type","button"); Before setting the attribute: After setting the attribute: [Try it Β»](#) ## Definition and Usage The setAttribute() method creates or changes a new attribute. If the specified attribute already exists, only the value is set. * * * ## Browser Support ![Image 9: Internet Explorer](#)![Image 10: Firefox](#)![Image 11: Opera](#)![Image 12: Google Chrome](#)![Image 13: Safari](#) The setAttribute() method is supported by all major browsers. Internet Explorer 8 and earlier versions do not support this method. * * * ## Syntax _element_.setAttribute(_attributename_,_attributevalue_) ## Parameters | Parameter | Type | Description | | --- | --- | --- | | _attributename_ | String | Required. The name of the attribute you want to add. | | _attributevalue_ | String | Required. The value of the attribute you want to add. | ## Return Value No return value. ## Technical Details | DOM Version | Core Level 1 Element Object | | --- | * * Element Object](#)
← Sql LikeMet Node Replacechild β†’