用单选框十字框控制div
编辑:它的工作问题是名称我传递了错误的名称(空格>_<)
我有4个div,它们在不同的框架中与我的单选框具有相同的ID,当单击单选框时我希望所有 div 消失(淡出)并且与当前单选框具有相同 id 的 div 出现(淡入)其与 $("input[type=radio]") 一起使用 但是当使用 $("input[type=radio][name=zone1_1]") 时它不起作用
verif_check(id_check)//id_check is id of my the radiobox i clicked in
{
$(document).ready(function(){
$("input[type=radio][name=zone1_1]").each(function(){
var id=$(this).attr("id");
$(parent.droite.document).contents().find(id).fadeOut();
});
$(parent.droite.document).contents().find("#"+id_check).fadeIn();
});
}
edit:it worked problem was with name i passed wrong name(a space >_<)
i have 4 div that have same id as my radio box both in diferent frame, when clicking on a radio box i want all div disapear (fadeOut) and the div with same id of my current radio box appear(fadeIn) its working with $("input[type=radio]")
but when using $("input[type=radio][name=zone1_1]") it dont work
verif_check(id_check)//id_check is id of my the radiobox i clicked in
{
$(document).ready(function(){
$("input[type=radio][name=zone1_1]").each(function(){
var id=$(this).attr("id");
$(parent.droite.document).contents().find(id).fadeOut();
});
$(parent.droite.document).contents().find("#"+id_check).fadeIn();
});
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ID 应该是唯一的。即任何两个元素都不应该具有相同的 ID。如果您想选择多个元素,请使用类名。
您的代码可能不是 foring,因为您使用 ID 调用
find()
,而不是#id
。以下内容将在一定程度上纠正您的问题:我也对
verif_check(id_check)
包装器感到困惑。我会删除这个。IDs shoud be unique. I.e. no two elements should have the same ID. If you want to select multiple elements use the classname instead.
You code may not be foring because you are calling
find()
with the ID, not#id
. The following will go some way to rectifying your problem:I'm also puzzled by the
verif_check(id_check)
wrapper. I would remove this.