i want to read the query string value from this anchor tag by jquery.
<td><a href="#?acckey={{user.key()}}" class="generate_url">Get URL</a></td>
this is what i wrote and it is not working
$('.generate_url').each(function () {
$(this).click(function () {
alert(acckey)
});
});
but this is not working. any one know to fix this issue?
It matches the
hrefvalue against a regular expression and uses the first memory group. Theacckeywill be set to empty string if no match was found.Update
To get the whole match (i.e. “acckey=xxx”), you would need to use
m[0]instead ofm[1].Btw, I’ve removed the
.each()because you were only adding a click handler.