I have been reading and studying about this library to be able to change the code of this codebox from jquery to javascript (https://codepen.io/mrWilson123/pen/OJMVwzd?editors=1010) but I got stuck in this part.
$(".slide-captions").html(function () {
return (
"<h2 class='current-title'>" +
currentTitle +
"</h2>" +
"<h3 class='current-subtitle'>" +
currentSubtitle +
"</h3>"
);
});
I understand that it's getting the div element and putting inner html code into it so I tried this but it didn't work.
document.querySelector(".slide-captions").innerHTML(
"<h2 class='current-title'>" +
currentTitle +
"</h2>" +
"<h3 class='current-subtitle'>" +
currentSubtitle +
"</h3>");
What am I doing wrong if someone could help me, thanks.
.innerHTML = "..."(it's a property, not a function). Please always check the API docs first, especially before posting a question.innerHTMLis and how to use it?innerHTMLis not a function.