I'm trying to make a super simple "see more.." link. I was doing it before with a button, but it didn't work very well on mobile, so I've changed it to a link, but I'm getting this error:
jquery-3.1.1.min.js:2 jQuery.Deferred exception: seeMore is not a function TypeError: seeMore is not a function
Here's the code. I reckon it's just a stupid syntax error somewhere.
$(document).ready(function(){
var seeMore = document.getElementById('seeMore');
seeMore.onclick=seeMore();
function seeMore(){
document.getElementById('infoText').innerHTML= 'More text';
};
function seeLess(){
document.getElementById('infoText').innerHTML= 'Less text';
};
});
and here's the linked seeMore ID.
<a href="#" id="seeMore">See More</a>
What's going on here??
variableandfunction.seeMoreEl.onclick=seeMorenotseeMoreEl.onclick=seeMore()seeMore.onclick=myFunction;