jQuery genera ID únicos
Esto es lo que tengo:
<a href="<?=$arItem["LINK"]?>"><?=$arItem["TEXT"]?></a>
Es una matriz PHP, que contiene algunos enlaces. Necesito agregar un parámetro hash extra#nav-link
hasta el final de cada enlace.
Así es como intenté hacerlo:
<a id="likeLink" href=""><?=$arItem["TEXT"]?></a>
<script>
$(document).ready(function () {
$("#likeLink").attr("href", <?=$arItem["LINK"]?> + "#nav-link");
});
</script>
Pero este código no funciona porque jQuery no sabrá a qué enlaces estoy enlazando. Así que supongo que necesito generar el únicoids
, pero no sé cómo hacerlo.