我正在动态生成iframe
及其id
。
现在我有一个情况来确定是否Id
已经存在。
我的代码将是,
function createIframe(intxnId){
alert("Id is : "+"$('#"+intxnId+"')");
if($("'#ch"+intxnId+"'").length == 0){
alert("Creating the new Iframe intxnId is: " +intxnId);
var iframe = "<iframe id='ch"+intxnId+"' src='" + contexPath + "/HeartChat.html?intxnId="+intxnId+"' class='iframeSize'></iframe>";
alert("iFrame Details : "+iframe);
$("#chatMessageArea").find("#messageArea").html(iframe);
}else{
alert("ID is already present !");
}
}
我对动态 ID 的警报是,
但我得到了错误,
好的答案绝对值得赞赏!