メニューがあり、各メニュー項目の href をコンテンツ項目 ID として次のように設定する必要があります。
$(this).attr("href") = $(".element").attr("id");
どうやって?
メニューがあり、各メニュー項目の href をコンテンツ項目 ID として次のように設定する必要があります。
$(this).attr("href") = $(".element").attr("id");
どうやって?
href を変更するには、次のようにします。
$("a").attr("href", $(".element").attr("id"))
幸運を。
$(this).attr("href",$(".element").attr("id"));
複数のメニュー項目がある場合は、jquery の each 関数を使用できます。
$(".yourMenuItemsSelector").each(function(){
$(this).attr("href",$(".element").attr("id"));
});