How can I check if the query string contains a q= in it using JavaScript or jQuery?
q=
You could also use a regular expression:
/[?&]q=/.test(location.search)