How to make the HTML link activated by clicking on the
  • ?
  • 后端 未结 14 2006
    没有蜡笔的小新
    没有蜡笔的小新 2020-12-07 16:18

    I have the following markup,

    14条回答
    •  北海茫月
      2020-12-07 16:52

      Use jQuery so you don't have to write inline javascript on

    • element:

      $(document).ready(function(){
          $("li > a").each(function(index, value) {
              var link = $(this).attr("href");
              $(this).parent().bind("click", function() {
                  location.href = link;
              });
          });
      }); 
      

    提交回复
    热议问题