I am setup right now to use a div
tag to trigger a hidden radio button. However, when I click once on the div
, the radio button switches, but it I must double click the div in order for the data to be sent via ajax. Any ideas on what is causing this and how to fix it?
jQuery
$(function(){
$(".albumcover_tag").click(function(e){
e.stopPropagation();
$('.edit_album').trigger('submit.rails');
});
$(".albumcover-item").click(function(e){
$('.albumcover-item').removeClass("radio-selected");
$(this).addClass("radio-selected");
$(this).find('input').click();
return false;
});
$('.albumcover_tag:checked').parent('.albumcover-item').addClass("radio-selected");
});
HTML
<div class="albumcover-item">
<label for="album_albumcover">Set as Album Cover </label>
<input class="albumcover_tag" id="album_albumcover_id_2" name="album[albumcover_id]" type="radio" value="2">
</div>
NOTE: I want to be able to enable the ajax on single click, not double click.