如何用相同的ID查找div的div insid [英] How to fin div insid of div with same id
本文介绍了如何用相同的ID查找div的div insid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
actulay
actulay
<div id="s">
<div id="s1">
</div>
</div>
<div id="s">
<div id="s1">
</div >
</div>
<div id="s">
<div id="s1">
</div >
</div>
<div id="s">
<div id="s1">
</div >
</div>
<div id="s">
<div id="s1">
</div >
</div>
在div上单击功能如何设置html
到s1 div
使用jquery
当我找到ID时,显示的第一个div ="s1"
我想分别单击s1在div上
例如:-我点击
包含内部s1的s div secodes
如何获得内部s1尊重
on div click function how to get are set html
to s1 div
using jquery
when i finding with id its showing first div ="s1"
i want on div s on click s1 as respectevely
ex :- i click on
s div secodes on that contain inner s1
how to get inner s1 respectevely
推荐答案
这里是问题:此HTML文档无效.要求每个id
属性值在整个HTML文档中都应该是唯一的.例如,请参阅:
http://www.w3schools.com/tags/att_global_id.asp [ http://api.jquery.com/id-selector/ [ http://api.jquery.com/category/selectors [
Here is the issue: this HTML document is invalid. It is required that eachid
attribute value should be unique in the whole HTML document. For example, please see:
http://www.w3schools.com/tags/att_global_id.asp[^].
Even though it won''t be a problem to find any nested element by some non-unique attribute value based on nesting structure, especially with jQuery, in case ofid
the problem becomes really trivial; you only need to fix HTML. I would recommend to use jQuery, which has an attribute selector:
http://api.jquery.com/id-selector/[^].
See also:
http://api.jquery.com/category/selectors[^].
—SA
这篇关于如何用相同的ID查找div的div insid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文