What is the best way to cut the file name from 'href' attribute of an 'a' element using jQuery?

后端 未结 6 533
傲寒
傲寒 2021-01-16 19:32

For example I\'ve got the simple code:

6条回答
  •  礼貌的吻别
    2021-01-16 20:15

    Here another way:

    var arr = [];
    $("ul.list li a").each (function(){
        arr.push( (this.href.match(/\/[^\/]+$/)[0] || '').substr(1) );
    });
    

提交回复
热议问题