JQuery1.7.2中$("img").size();取不到值
我写的HTML中有两个IMG,如下:
<div>
<table>
<tr>
<td>
<asp:Label ID="lblTime" Text="时间" runat="server"></asp:Label>
<asp:TextBox ID="txtTime" onfocus="setday(this)" runat="server" ReadOnly="true"></asp:TextBox>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<input type="text" name="txtTest" />
<img src="Images/test0.jpg"/>
<img src="Images/test1.jpg"/>
</td>
</tr>
</table>
</div>jQuery
我写的HTML中有两个IMG,如下:
<div>
<table>
<tr>
<td>
<asp:Label ID="lblTime" Text="时间" runat="server"></asp:Label>
<asp:TextBox ID="txtTime" onfocus="setday(this)" runat="server" ReadOnly="true"></asp:TextBox>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<input type="text" name="txtTest" />
<img src="Images/test0.jpg"/>
<img src="Images/test1.jpg"/>
</td>
</tr>
</table>
</div>jQuery
贴出最终生成的html吧, 不要aspx的源文件。 还有贴出你写的js.其实就把最终生成的页面保存为一个html文件, 再去掉不相关的东西就可以了。
对啊,你的问题木有说清楚啊,不过我感觉好像与这段js所放的位置貌似木有关系吧,所有的js代码都会被预编译的
$(function () {
alert($("img").size());
});
</script>