常用选择器
$("#id")
$("#id[属性=严格等于某值]")
$("#id[属性*=包括等于某值]")
$("#id[属性^=开头等于某值]")
获取“旁边”的dom对象,如
html代码
<table cellpadding="0" cellspacing="0" style="border-width:0;">
<tr>
<td><div style="width:20px;height:1px"></div></td><td><div style="width:20px;height:1px"></div></td><td><img src="/WebResource.axd?d=GJIAHC0qaD_Qd2W3ZyuUjneousXI9PWQaR6nrlCRLB01&t=634096404762656250" alt="" /></td><td style="white-space:nowrap;"><input type="checkbox" name="TreeView1n2CheckBox" id="TreeView1n2CheckBox" /><span class="TreeView1_0" href="6" id="TreeView1t2">产品</span></td>
</tr>
</table>
如果想在选上checkbox的时候获取span里面的href的属性,可以用
获取span里的文字是用$.text(); <--> 设置span里的文字是用$.text(内容);
-->类似地,很多属性都是括号里有字符就是设置,没有就是获取(例如p对象)
获取input type="text"里面的内容 是用$.attr("value")<--> 设置这里面的内容是用$.attr("value",settingstr)
-->也有相当一部分对象的属性是用一个参数获取,两个参数表示设置的
input type="button"的单击事件:$.click(function(){//do sth;});
input type="checkbox"的单击事件:比较复杂,附例子