Hey,
My following code doesnt seem to be working, it doesnt change the onclick function when you click the image... can someone please help me?
Jquery is includes at the top of my page...
<script type="text/javascript">
function addfav(id){
var div = '#fav_'+id;
$(div).attr("src","images/star.png");
$(div).unbind('click');
$(div).click(function() {
removefav(id);
return false;
console.log('did function');
});
alert('added');
}
function removefav(id){
var div = '#fav_'+id;
$(div).attr("src","images/star-empty.png");
$(div).unbind('click');
$(div).click(function() {
addfav(id);
return false;
});
alert('removed');
}
</script>
<img src="images/star-empty.png" id="fav_1" onClick="addfav(1);">
Thanks
Dan