Basically I am adding a class of "id" when a <div> is clicked. The ID is updated to "active"
http://mpagallery.co.uk/exibitions/future/
If you click on the small image, the builder-gallery-item <div> needs to add a id="active" to the end.
Here is what I have tried in my fiddle, and have exactly the same code in an external file, but it just won't work.
jQuery(function ($) {
$(document).ready(function ($) {
$('.builder-gallery-item').on('click', changeClass);
});
});
function changeClass() {
$('.builder-gallery-item').removeAttr('id', 'active');
$(this).attr('id', 'active');
}
.removeAttr()expects one parameter, which is the attribute you want to remove.