If I have a dropdown in my html document looking like this:
<select id="myDropdown">
<option value="apple">Apple</option>
<option value="orange">Orange</option>
<option value="banana">Banana</option>
</select>
and I want to hook up on the change event with JQuery, then both of these approaches seem to work with JQuery:
$("#myDropdown").change(function () {
// Do something
});
and
$('#myDropdown').on('change', function () {
// Do something
});
What is the difference between these two, and is one of them to prefer?