I want to set id of an element. I’m using php dom. I could not understand how following will work.
DOMElement::setIdAttribute ( string $name , bool $isId )
The only description I found for this in manual is –
Declares the attribute name to be of type ID.
How can I do this ?
If you want to add an id attribute to your html element so that it looks like
<p id="frob">...you dont usesetIdAttribute()– it declares that the attribute$namecan be used as an unique identifier for that element – as an alternative/addition of theidattribute. UsesetAttribute()like so: