Something’s not quite right here.
$(document).ready(function()
{
$("a#edit").click(function() {
$("div#search").addClass("hidden");
$("div#edit").removeClass("hidden");
alert((this).val());
return false;
});
}
);
And later:
<a href="#" id="edit">10.1001</a>
I want to get the value “10.1001” from this. alert((this).val()); doesn’t seem to work, nor does alert((this).text());. Can someone point out really quickly what I’m missing here? Thanks!
Instead of
(this).val()you want$(this).text()for anchors..val()is for input type elements,.text()is used to get the text within a tag 🙂Your code should look like this overall, note the addd
$before(this):