现在,我使用的是这样的:如何使用jQuery在此href属性中添加“#”?
// Scroll to matched dish
$("#scrolll").click(function() {
$("a#scrolll").attr("href", $("li.matched").attr("id"));
return false;
});
要添加到li.matched
a#scroll
的href属性的ID。 例如,如果li.matched
有#menu123
的ID,a#scrolll
看起来就像这样:
<a id="scrolll" href="menu123">
但我想使它看起来像这样:
<a id="scrolll" href="#menu123">
任何建议,以做到这一点?
西部最快的枪 – alexchenco