Reputation: 87
I have a checkbox element that has two classes.And this classes click event ı do some stuff. onchangeofvalidationandsubquestion is always trigger first but i want to it to execute first "radior" click event than "onchangeofvalidationandsubquestion" event.Any ideas will be helpful
$(".radior").click(function (event) {
});
$(".onchangeofvalidationandsubquestion").click(function (event) {
});
var $radio = $('<input class="radiowidther" type="checkbox" />').appendTo($div);
$radio.addClass("radior");
$radio.addClass("onchangeofvalidationandsubquestion");
Upvotes: 1
Views: 907
Reputation: 4022
You could always add your own custom event to be triggered after:
$(".radior").click(function (event) {
$(".onchangeofvalidationandsubquestion").trigger('myCustomEvent');
});
$(".onchangeofvalidationandsubquestion").on('myCustomEvent', function (event) {
});
This way the click event is guaranteed to be processed first.
Here's a quick little jsfiddle for registering and triggering custom events with jQuery:
Upvotes: 1