HTML 表单中 li 元素内有 li 的替代方法
我正在创建一个表格,其中包含“您隶属机构吗?” Y/N' 问题应该显示另一个包含相关信息的小表格。 我正在尝试使用 jQuery fadeIn()
fadeOut()
方法 &试图显示子窗体。但当我尝试这样做时。
将
中的另一个li
标签放入整个表单中试图打电话。但它说我不能将li
放入 XHTML 1.0 Transitionalli
中,当我尝试将子表单放入
div
中时,它说div
不能放置在ul
元素内。
有办法解决这个问题吗?我想更改 DOCTYPE 就可以了,但我现在确定哪一个是好的,或者可能还有其他方法来处理标签。
第 2 部分:
我成功地让我的子表单淡入淡出功能正常工作。但是当我第一次按 Y 时 &然后选择N选项。这两个子表单被连接起来。我想我必须编写更多的 javascript 才能使其成为互斥事件。这是我的 js
<script type="text/javascript" >
$(document).ready(function() {
$('#subafform').hide();
$("#element_4_1").click( function(){
if( $(this).is(':checked')) {
$('#subafform').fadeIn();
} else {
$('#subafform').fadeOut();
}
});
});
</script>
类似地,对于 NO 选项我的 js:
<script type="text/javascript" >
$(document).ready(function() {
$('#subnonafform').hide();
$("#element_4_2").click( function(){
if( $(this).is(':checked')) {
$('#subnonafform').fadeIn();
} else {
$('#subnonafform').fadeOut();
}
});
});
</script>
谢谢,
I am creating a form where in 'Are you affiliated to institution? Y/N' question should show up another small forms which have the relevant information.
I am trying to have the jQuery fadeIn()
fadeOut()
methods & trying to show the subform. but when I try to do it.
putting an
li
tag to whole form & trying to call. But it says I cannot putli
inside anotherli
in XHTML 1.0 TransitionalWhen I try to put the subform inside the
div
then it saysdiv
cannot be placed insideul
element.
Is there a way to work around this? I am thinking changing the DOCTYPE would do but I am now sure which one would be good one or may be there is some other way to work around with the tags.
Part 2 :
I succesfully got to work my subform fading thing working. But When I press Y in first instance & then select N option. The two subforms get concatenated. I think I have to write more of the javascript to make it a mutual exclusive event. Here is my js
<script type="text/javascript" >
$(document).ready(function() {
$('#subafform').hide();
$("#element_4_1").click( function(){
if( $(this).is(':checked')) {
$('#subafform').fadeIn();
} else {
$('#subafform').fadeOut();
}
});
});
</script>
Similarly for NO option my js:
<script type="text/javascript" >
$(document).ready(function() {
$('#subnonafform').hide();
$("#element_4_2").click( function(){
if( $(this).is(':checked')) {
$('#subnonafform').fadeIn();
} else {
$('#subnonafform').fadeOut();
}
});
});
</script>
Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不能将 li 放入 li 中,但可以将其放入 ul 中
You cannot put an li in an li, but you can put it in a ul
类似地,
的直接子代。但它可以是- 的直接子代。里面
。
<li> cannot have direct <li> children. Make sure whatever you have written is not trying to make that happen.
Similarly, <div> cannot be a direct child of <ul>. But it can be a direct child of <li> inside <ul>.