I have an assignment to create a sliding picture puzzle of sorts, where you can click on each image (which is part of a ninja picture) and an alternate image (parts of a cat picture) appear in its place. A sort of slot machine to match two images. We are supposed to make use of custom attributes (data-alt-src in the code) and make no use of JavaScript variables or any CSS. I am simply not understanding how to make use of custom attributes to swap images. The assignment says not to take longer than 2 hours making this and am far past this. I've been trying variations of the jQuery script to use .attr, but to no avail.
<script>
$(document).ready(function(){
$('img').click(function(){
$(this).slideToggle('data-alt-src');
$(this).slideToggle();
})
})
</script>
<img src='ninja0.png' data-alt-src='cat0.png' />
<br/>
<img src='ninja1.png' data-alt-src='cat1.png' />
<br/>
<img src='ninja2.png' data-alt-src='cat2.png' />
<br/>
<img src='ninja3.png' data-alt-src='cat3.png' />
<br/>
<img src='ninja4.png' data-alt-src='cat4.png' />