Can jQuery detect a specific URL and perform a function based off that URL?

后端 未结 3 806
Happy的楠姐
Happy的楠姐 2021-01-15 03:24

I have a site I\'m working on. I need to be able to perform a specific function if the URL matches a specific URL. Here\'s an example of what I\'m trying to do:

If

3条回答
  •  伪装坚强ぢ
    2021-01-15 04:09

    var url = "http://www.example.com/EIFS-items/search.php?l2=3,15,25";
    $(function(){
      if (location.href==url){
        $('.content').show();
      }
    });
    

提交回复
热议问题