Jump to content

SetAttribute(id,"1") vs Object.id = "1"


Thierry

Recommended Posts

Was wondering which is better to use, or more reliable across browsers.

The object is a div, and it is created with document.createElement.

 

The id will later be used for a few JS functions, but which one should I use?

 

For as far as I can see doing:

 

divRow.SetAttribute("id", "1")

 

is the same as:

 

divRow.id = "1";

 

Which should I use, and which is faster in performance?

Link to comment
https://forums.phpfreaks.com/topic/155621-setattributeid1-vs-objectid-1/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.