[英]jquery checkbox element class click
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
onchangeofvalidationandsubquestion总是首先触发,但我希望它执行比“ onchangeofvalidationandsubquestion”事件第一个“ radio” click事件。任何想法都将有所帮助
$(".radior").click(function (event) {
});
$(".onchangeofvalidationandsubquestion").click(function (event) {
});
var $radio = $('<input class="radiowidther" type="checkbox" />').appendTo($div);
$radio.addClass("radior");
$radio.addClass("onchangeofvalidationandsubquestion");
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. 这样,可以确保先处理click事件。
Here's a quick little jsfiddle for registering and triggering custom events with jQuery: 这是一个快速的小jsfiddle,用于使用jQuery注册和触发自定义事件:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.