Capturing checkbox event in js for executing script

Hi everyone,
I am working on a form and stuck with something.
I am trying to execute a script on checkbox. Here is the code that i used for similar scenario in JS and it is working, but for some reason this code is not working. Even when i put in script tags in html file or in JS file. So is there some thing, i am doing wrong or Do i need to completely change my script or make few changes to make it working. here is my code.

 $("#check_experience").change(function() {
alert('hit one');
  if(this.checked) {
//set of JS functionality i want to use
  }
});

//i even tried meteor code but it didn't work
Tempate.templatename.events({
'checked #check_experience': function(){
alert(hit two);
//i tried to execute this Meteor equivalent but for some reason but it is  not working for some reson
}
});

thanks in advance for those who are putting any effort.

I don’t believe there is an event called checked. Maybe you should change your event listener to change?

Template.checkbox.events({
  "change #check_experience"(event, instance) {
    console.log(event.currentTarget.checked);
  }
});
2 Likes

Yeah you definitely want the change or input event