Get query string value from URL in plain JavaScript

Last time when I was working in a HTML file I was needed to read the query string values and wanted to do some dynamic operations with those, but you know we cannot straight away read the query string values unless we use a server side technology.

So I searched in the Internet got a lot of examples but most of them are used Regular expression. I’m not quite comfortable with Regular Expressions, So I decided to find a simple script which anybody can easily understand it.

Here is the script:

Usage Example:

The above code is self explanatory, you can easily understand if you have good knowledge in JavaScript.

And here is the demo:




Related Posts

Leave a Reply