0

New in JS, How do I check if one of my querystring has a value?

Example: I have result.aspx?loc=3. How do I check this in javascript if my querystring loc has a value. I need to do this because I will use $('#target').css({'display':'none'}); to a certain div

1 Answer 1

4

try location.search

The search property returns the query portion of a URL, including the question mark (?).

and can be called like so:

<script type="text/javascript">
    document.write(location.search);
</script>

http://www.w3schools.com/jsref/prop_loc_search.asp

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.