Given a link like so:
<a href="/users/xxxx?width=640" class="dialogOnClick">Create Account</a>
I have
$('.dialogOnClick').live('click', function() {
// How to get 640, given we look for the width param?
console.log( $(this).?????)
});
When a user clicks on a link with the class dialogOnClick, I want to check if there is a width query param and if so, obtain the value. In the case above being 640. Is this possible?
Thanks
The element’s
searchproperty will contain the query string.Then you could either parse it into key & value pairs, or just use a regex for this simple example.
jsFiddle.
This will fail if there are no matches however. You may want to assign the return of
match()to a variable and test if first to ensure it has required element.