替代在HTML表单中使用li里面的li元素

时间:2022-11-14 20:03:29

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.

我正在创建一个表单,其中“你是否隶属于机构? Y / N'问题应该显示另一个包含相关信息的小表格。我正在尝试使用jQuery fadeIn()fadeOut()方法并尝试显示子表单。但是当我尝试这样做的时候。

  1. putting an li tag to whole form & trying to call. But it says I cannot put li inside another li in XHTML 1.0 Transitional

    将li标签放到整个表单并尝试呼叫。但它说我不能把李放在XHTML 1.0 Transitional中的另一个里面

  2. When I try to put the subform inside the div then it says div cannot be placed inside ul element.

    当我尝试将子表单放在div中时,它表示div不能放在ul元素中。

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.

有办法解决这个问题吗?我正在考虑改变DOCTYPE会做但我现在确定哪一个是好的或者可能有其他方法来解决这些标签。

Part 2 :

第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

我成功地完成了我的子窗体衰减工作。但是当我在第一个实例中按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>

Similarly for NO option my js:

同样对于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>

Thanks,

2 个解决方案

#1


7  

You cannot put an li in an li, but you can put it in a ul

你不能把李放在里面,但你可以把它放在一个ul

<ul>
  <li>
    <ul>
      <li></li>
    </ul>
  </li>
</ul>

#2


2  

<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>.

    同样,

    不能是
      的直接子项。但它可以是
    • 里面
        的直接孩子。

    #1


    7  

    You cannot put an li in an li, but you can put it in a ul

    你不能把李放在里面,但你可以把它放在一个ul

    <ul>
      <li>
        <ul>
          <li></li>
        </ul>
      </li>
    </ul>
    

    #2


    2  

    <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>.

    同样,

    不能是
      的直接子项。但它可以是
    • 里面
        的直接孩子。