jquery中获取table下的所有类型为text的input对象,谢谢 table id为“aaa”。那如题的要求该怎么写,谢谢大侠帮忙解决 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 $("table #aaa")详情参照http://jquery-api-zh-cn.googlecode.com/svn/trunk/index.html检索器 那怎么获取该table下类型为text的input对象呢? $("#aaa input[type='text']")没看清题目 感谢,我先去试试。prototype是这样用的的,还以为jquery不是这样用的呢 小狼: $("#aaa input[type='text']").each(function(i){ alert(this.value); this.value = ""; });我想把这些类型为text的input值全部清除,这样写可以吗?指点一下,谢谢 $("input[type='text']", $("#aaa")) <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> new document </title> <script type="text/javascript" src="jquery-1.3.2.js"></script> </head> <body> <table id="aaa"> <tr> <td><input type="text" size="20" /></td> <td><input type="text" size="20" /></td> <td><input type="text" size="20" /></td> </tr> <tr> <td><input type="text" size="20" /></td> <td><input type="text" size="20" /></td> <td><input type="text" size="20" /></td> </tr> </table> <input type="text" size="20" /> <input type="text" size="20" /><script type="text/javascript"><!--alert($("input[type='text']", $("#aaa")).length);$("input[type='text']", $("#aaa")).css("background-color","#F00");//--></script> </body></html> $("#aaa :text").val("");就行了. 你这样就把aaa里所有的text checkbox file button...全都搞一遍了... 抱歉没注意到类型为text那这样好了$("#aaa~input[type='text']") 关于js中原型对象的几道题 请教高人: 输入框文字拖拽的问题 <script type="text/JavaScript"> 求思路: 过滤页面正文的内容,给一些特定的文字或者词汇加上事件响应 用正则分析页中的远程地图片地址并取出 js导出表格到excel的时候如何控制单元格的格式 请大家帮我看看该如何做 求表单输入后自动更新文本的代码,在线等 在JAVASCRIPT里面怎么判断是否为数字? 我在网页上使用了FLASH,但如何让背景透明喃?我的背景不透明,好难看 怎样通过js将excel表格中的内容直接复制到网页? TEXT问题
详情参照http://jquery-api-zh-cn.googlecode.com/svn/trunk/index.html检索器
没看清题目
$("#aaa input[type='text']").each(function(i){
alert(this.value); this.value = "";
});
我想把这些类型为text的input值全部清除,这样写可以吗?指点一下,谢谢
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> new document </title>
<script type="text/javascript" src="jquery-1.3.2.js"></script>
</head>
<body>
<table id="aaa">
<tr>
<td><input type="text" size="20" /></td>
<td><input type="text" size="20" /></td>
<td><input type="text" size="20" /></td>
</tr>
<tr>
<td><input type="text" size="20" /></td>
<td><input type="text" size="20" /></td>
<td><input type="text" size="20" /></td>
</tr>
</table>
<input type="text" size="20" />
<input type="text" size="20" />
<script type="text/javascript">
<!--
alert($("input[type='text']", $("#aaa")).length);
$("input[type='text']", $("#aaa")).css("background-color","#F00");
//-->
</script>
</body>
</html>
就行了.
抱歉没注意到类型为text
那这样好了$("#aaa~input[type='text']")