How do I get the variable in the titleText "Some Name" from the JS file to populate or take the title from the hyperlink "sometitle" in the HTML code?
JS
var randomtext={ titleText:"Some Name",}
HTML
<a class="css" title="sometitle" href="#">Your HTML Here</a>
I would like the JS to then change to:
JS
var randomtext={ titleText:"sometitle",}
Titletext name coming from the title in the anchor of the hyperlink
I tried the following and it didn't work
JS
var randomtext={
titleText:document.getElementsByClassName('css')[0]; randomtext.titleText = anchor.getAttribute('title');,
title2: "name1",
title3: "name3",
title4: "name4",
}