jquery 属性选择器

jack_liu4Ye 2011-01-04 04:30:50

取出页面中包含属性relatedId='firPer'的表单,页面表单有input,也有label。
...全文
61 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
Quinn2 2011-01-04
  • 打赏
  • 举报
回复
原来楼主已经弄好了,看来我错了!
Quinn2 2011-01-04
  • 打赏
  • 举报
回复
希望对楼主有用
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
</head>
<body>
<form relatedid='firPer'>
<input type="button" />
<input type="checkbox" />
<input type="file" />
</form>
<select>
<option>Option</option>
</select>
<textarea></textarea>
<button>
Button</button>
</body>
</html>
<script>
//遍历relatedid='firPer'下面的表单元素,如果取值的话,同理可得
$("[relatedid='firPer'] >input").each(function () {
alert($(this)[0].type);
});
</script>
jack_liu4Ye 2011-01-04
  • 打赏
  • 举报
回复
晕,原来不是选择器的问题,谢过版主。。
jack_liu4Ye 2011-01-04
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 hb_yanhu 的回复:]

楼主到底要实现什么?描述清楚一点,也可以直接贴代码!
[/Quote]
我说的很明白了吧


取出页面中包含属性relatedId="firPer"的所有表单。。

Mr-Jee 2011-01-04
  • 打赏
  • 举报
回复
$("[relatedId='firPer']")
Quinn2 2011-01-04
  • 打赏
  • 举报
回复
楼主到底要实现什么?描述清楚一点,也可以直接贴代码!
jack_liu4Ye 2011-01-04
  • 打赏
  • 举报
回复
怎么,没人会吗。。

87,907

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧