As OP said "on click of a button the portoflio is loaded through PHP", I assume the portfolio content is loaded via AJAX. So, you have to use this to listen the event on the element :
jQuery(document).on('click', '.portfoliopod', function(){
jQuery('.portfoliopod').addClass('current');
});
As the .portfoliopod
element is a dynamically created element, the code you're currently using won't bind the event to element that is going to come in the DOM tree later.
So, the way of binding the listener is to bind it on document
and check if the element clicked on document
is .portfoliopod
. See this.
Also, it seems like on your site, $
is undefined (very strange). So, use jQuery
instead.
Or, if you want the $
object, add this code at the very end of your jQuery file before })(window);
:
window.jQuery = window.$ = jQuery;