jQuery [removed]() child selector

前端 未结 3 948
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-28 18:05

I have a ul and i want create an alert when i click on a child li.

    3条回答
    •  我在风中等你
      2021-01-28 19:06

      ul elements can only contain li elements eventually mixed with ol and ul elements. You can can fix your html and jquery to be like:

      $(document).on('click', '#myul ul li', function() {
        alert('hey!');
      });
      ul,
      li {
        list-style-type: none;
      }
      
      
        • rasd
        • sadsad

    提交回复
热议问题