Thierry Posted April 25, 2009 Share Posted April 25, 2009 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? Quote Link to comment Share on other sites More sharing options...
Axeia Posted April 25, 2009 Share Posted April 25, 2009 SetAttribute is a more global approach and I think it has a few issues with older versions of IE for certain attributes, I'd go with .id = Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted April 26, 2009 Share Posted April 26, 2009 use jquery... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.