var $forms = $('form.vote');
$forms.submit(function(){
return false;
});
$('.votebtn').on('click',function(){
$this.closest('form').trigger('vote_now', [$(this).val()]);
});
$forms.on('vote_now',function(value){
alert(value);
});
vote_now should be triggered and popup the value but something’s wrong. What is it?
You forgot
var $this = $(this);, and the extra arguments will be passed after the event object.JSFIDDLE DEMO