Creating a click event for an input is easy
$('input').click(function () {
alert('adsf');
});
But how can I be selective so that the previous code only works on type checkbox or of type button, rather than using the generic ‘input’ selector?
You can use some built-in Selectors like
:checkboxand:buttonto find these elements easily.There’s also
:radio,:submit,:text, and:inputselectors, among others