In my form, I have no.of form elements, I would like to remove all the listeners from the form elements.. how to achieve this?
here is my try, but not working..is this only way to remove each one by one?
var testFunction = function () {
$form = $('form'),
$name = $form.find('#name'),
$code = $form.find('#code'), //it will have more events..
$city = $form.find('#city'), //it will have more events..
$native = $form.find('#native'), //it will have more events..
$gender = $form.find('#gender'), //it will have more events..
$select = $form.find('#select'); //it will have more events..
//sample.
$name.on('focus keydown input', function(e){
console.log(e.target.value);
});
$select.on('change', function(e){
console.log($(this).val());
});
}
testFunction();
$('#unbindForm').on('click', function(){
$('form').addClass('highlight').off(); //i can't remove all events?
});
what would be the correct approach. in the off
do i need to send all listeners what i used? (change keydown input
)?