比如说var div = document.creatElement("div");
var p = document.creatElement("p");
div.appendChild(p);这样,我不把div添加到html结构中,有办法通过document.getElementByTagName或者jquery选择到这个p么?
var p = document.creatElement("p");
div.appendChild(p);这样,我不把div添加到html结构中,有办法通过document.getElementByTagName或者jquery选择到这个p么?
解决方案 »
- 百度Map maker 问题 麻烦有做过的大神指导下,谢谢
- extjs4 grid's cell不可复制问题?
- js+swf图片切换非常怪的问题,同样的代码,在两个服务器上,一个可以播放,一个不可以
- 用button如何关闭popup
- checkbox一个很奇怪的现象
- 关于datagrid隐藏问题
- 一个关于LOCATION很怪且很有意思的问题
- 有关checkbox.
- 有高手知道该怎样解决吗??(在线)
- 用window.open一个IE窗体,在窗体关闭后在原窗体上怎么能得到我所选的某项信息的值,填加在我原窗体的text中如下代码:
- 初学javascript,请教小白问题
- 他的意思是到底会改变还是不会改变?
var p = document.creatElement("p");
p.setAttribute('id','SignP');
div.appendChild(p);然后document.getElementByID('SignP')不就可以么
document.getElementById是Document对象的方法,用于获取文档对象中的元素,但是你的对象并没有添加到文档中,而只是存在于内存中,所以不可以。