How do I use jQuery to ignore case when selecting?

前端 未结 4 825
不知归路
不知归路 2020-12-09 10:45

I\'m currently attempting to disable a link using the following jQuery selector:

$(\"a[href$=/sites/abcd/sectors]\").removeAttr(\"href\");

4条回答
  •  自闭症患者
    2020-12-09 11:06

    You may use function "is" in jQuery. It is not case-sensitive.

       $("a").each(function() {
         if ($(this).is("a[href$=/sites/abcd/sectors]")) {
           $(this).removeAttr('href');
         }
       })
    

提交回复
热议问题