(简单)HTML属性是否允许在分配之间留有空格 [英] (Simple) Are HTML attributes allowed to have spaces between assignments
本文介绍了(简单)HTML属性是否允许在分配之间留有空格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在将一些属性解析为字符串,因此我需要知道HTML / XHTML元素属性中如何使用空格:
I'm doing some attribute parsing as a string, so I need to know how spaces are used in HTML/XHTML element attributes:
<div id='myid' width='150px' />
这也是正确的吗?
<div id = 'myid' width = '150px' />
如果有人知道使用JavaScript迭代属性及其值的其他方法,我会感兴趣的知道。
If anyone knows other ways of iterating through attributes and their values using JavaScript, I'd be interested to know.
推荐答案
是的,两者都是正确的。您需要使用DOM,而不是字符串解析。查看 jquery 。
Yes, both are correct. Rather than string parsing, you'll want to use the DOM. Check out jquery.
这篇关于(简单)HTML属性是否允许在分配之间留有空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文