Home  >  Article  >  Backend Development  >  jquery $("nam") 获取不到js生成的html的id ? 来看下代码

jquery $("nam") 获取不到js生成的html的id ? 来看下代码

WBOY
WBOYOriginal
2016-06-13 13:44:301486browse

jquery $("#nam") 获取不到js生成的html的id ?? 高手进来看下代码!
大家可直接复制我代码到php文件里面 测试一下! 意思就是: 我用js生成了一个html 文本框,id值是nam! 拿jquery获取不到这个id 但是我在本来页面也写了一个文本框,id值是ad, 拿同样的jquery 就能获取到! 这是为什么? 我用什么办法可以获取到这个id='nam' 的id?

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="../js/jquery-1.6.1.min.js"></script>


 <div id="d"></div>
<input type="button" id="b" value="添加出库单" onclick="add()">
<input type="text" name="ad" id="ad">


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn