当jquery中的动态时,.html()不起作用... [英] .html() is not working when it is dynamic in jquery...
本文介绍了当jquery中的动态时,.html()不起作用...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的专家,
在我的项目中,我使用.html()函数复制了一些HTML内容。
但是当我动态地将Id传递给.html()函数然后它不工作...
请参阅JsFiddle
请帮我解决这个问题..
谢谢
Dileep
Dear Experts,
In my project i have used .html() function to copy some html contents.
But When i passed the Id to .html() function dynamically then it is not working...
Please see the JsFiddle
Please help me to solve this..
Thanks
Dileep
推荐答案
问题在于你引入了标识符周围的单引号。他们不需要。请参阅下面的更正代码,因为它完全符合您的要求:
The problem is that you introduced single quotes around the identifier. They are not needed. See the corrected code below as it does exactly what you want:
var _UCID = 'ef6a5118-5282-4930-bb21-4f825da20840'
var UID = "#" + _UCID;
alert(UID);
alert(
(UID).html());
(UID).html());
问候,
var _UCID = 'ef6a5118-5282-4930-bb21-4f825da20840';
var html =
这篇关于当jquery中的动态时,.html()不起作用...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文