jQuery的.append()区分大小写元素 [英] jquery .append() case sensitive element

查看:162
本文介绍了jQuery的.append()区分大小写元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我需要创建一个表单数据的XML将其发送到Web服务。问题是, .append()不区分大小写,因此 .append('< EDO />')将创建<&江户GT; 。但是,XML是大小写敏感的,所以有没有办法怎么解决呢?而且我选择使用domObject而不是字符串,因为这样一来,我没有写endtags,这将是非常困难的在我的方案。

Hi I need to create xml from data in form to send it to webservice. The problem is that .append() is case insensitive, so .append('<EDO />') will create <edo>. But xml is case sensitive, so is there a way how to solve this? And I've chosen to use domObject instead of string, because this way I don't have to write endtags, what would be very difficult in my scenario.

推荐答案

最后为@弗雷德里克哈米迪说,为了使区分大小写的xml我使用这些功能:

Finally as @Frédéric Hamidi said, to make case sensitive xml I used these functions:

VAR DOMA = $ .parseXML(&LT; EDO_A /&gt;中)documentElement; 以创建元素

$(DOMA).append($ parseXML('&LT; EDO_Child /&GT;')documentElement); 来从字符串添加子

$(DOMA).append(domB) domA.appendChild(domB)添加子​​对象

这篇关于jQuery的.append()区分大小写元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆