I’m modifying the content of a href attribute with jQuery:
$("a#scrolll").attr("href", "#" + $("li.matched").attr("id"));
<a href="#">scroll</a>
and the output looks like this:
<a href="#menu-id-123">scroll</a>
If I click the link I’m taken to the element with that ID.
Below that jQuery line, I have the following:
$("a#scrolll2").click(function() {
$("a#scrolll").trigger("click");
});
With gives me something like this:
mydomain/somestuff#
So I think even if the a#scrolll link has now an ID in its href attribute, the jQuery code is is till thinking the attribute is the initial one (‘#’).
How can I tell jQuery to use the newly generated href attribute?
Use this