The below function is returning [object Object] instead of the html/text in the element, only on first click. Every subsequent click returns the element text. I've tried using .html and .text - that doesn't work. The problem seems to be when I add the onclick function, because if I remove the onclick and simply use $("#id").html()
with no click function, it works.
+ $('.education-modal-link').on('click', function(e) {
e.preventDefault();
var modalCaptionTextCall = $(this).prev('div').html();
$('div.modal-caption').eq(0).html(modalCaptionTextCall);
})
What am I doing wrong?
see problem at this link: http://johnhoich.com/homepage Scroll down to education section and click on an education content card.