I am trying to dynamically change url under the header with js function. Unfortunately I stack on some easy part.
According to link I tried to solve that problem...
Simplified version of my code:
<div class="details">
<h1 id="title">Old title</h1>
<h3 id="author">
<a id="aId" href="https://www.google.pl/">Old author</a>
</h3>
</div>
Script:
var title = $("#title");// the id of the heading
var author = $("#author");// id of author
title.text("New title");
author.text("New author");
var a = document.getElementById('aId');
a.href = "bing.com"
The problem is that Author now is not clickable. Could you help me?
EDIT:
Thanks for your help! Solution:
var title = $("#title");// the id of the heading
var author = $("#author a");// id of author
title.text("New title");
author.text("New author");
author.attr("href", "http://bing.com")