2011-04-12 72 views
1

我已经将表单数据收集到隐藏字段中,因为从textarea/tinymce生成的html片段夹在节元素之间。这被作为php/htmlentities编码存储到数据库中。当用jquery进行检索和检查时,对于Internet Explorer(报告更多元素)和其他浏览器(如firefox,chrome)(报告4个元素,如预期的)之间的相同数据,元素数量会有所不同,因此依赖操作会失灵。样本数据如下。与xml/html数据的jquery在Internet Explorer中表现不同

<section id='data1'>html data 
generated by tinymce instance 
1</section> <section id='data2'>html 
data generated by tinymce instance 
2</section> <section id='data3'>html 
data generated by tinymce instance 
3</section> <section id='data4'>html 
data generated by tinymce instance 
4</section> 

我检查了冲突/干扰,因为tinymce。它可以安全地排除,因为相同的代码在firefox/chrome中工作。有人能帮我解决这个问题吗?

问候。

回答

0

Internet Explorer通常将空白视为空元素,但我认为jquery固定(或解决了)。也许你应该只计算段元素而不是所有元素。

编辑:我在jsfiddle中试过这个:http://jsfiddle.net/9aEsh/ 在这个例子中IE7返回8而不是4,所以定义你想要计算的元素! IE < 9将textnodes作为元素进行计数。 IE9没有这个问题。