How to check if a query string value is present via JavaScript?

后端 未结 10 1901
眼角桃花
眼角桃花 2021-01-30 00:25

How can I check if the query string contains a q= in it using JavaScript or jQuery?

10条回答
  •  再見小時候
    2021-01-30 01:16

    one more variant, but almost the same as Gumbos solution:

    var isDebug = function(){
        return window.location.href.search("[?&]debug=") != -1;
    };
    

提交回复
热议问题