Possible Duplicate:
Set attribute without value
Sometimes, when handling with HTML, it is required to set an attribute of a DOM element without using any value, e.g. see the selected
parameter here:
<select id="auto-makers">
...
<option value="fiat" selected>FIAT</option>
<option value="ford">FORD Motor Company</option>
<option value="gm">General Motors</option>
...
</select>
This kind of attributes in HTML documents are a not rare. For instance, here follows a list of possible attributes:
checked
;selected
;required
;multiple
;disabled
;- etc.
How can I set a property with no value at runtime using Javascript and/or jQuery?