(Simple) HTML attributes allow spaces between assignments

I do attribute analysis as a string, so I need to know how spaces are used in the attributes of an HTML / XHTML element:

<div id='myid' width='150px' /> 

Is it correct?

  <div id = 'myid' width = '150px' /> 

If someone knows other ways to iterate through attributes and their values ​​using JavaScript, I would be interested to know.

+6
javascript html
May 6 '09 at 6:18
source share
2 answers

Yes, both are correct. Instead of parsing the string, you'll want to use the DOM. Check out jquery .

+8
May 06 '09 at 6:24
source share
β€” -

Gaps allowed. If you are analyzing attributes, why don't you parse the browser? If you use innerHTML, than get elements with a list of attributes

+2
May 6 '09 at 6:24 a.m.
source share



All Articles