2.1 KiB
2.1 KiB
.submit
Description Bind an event handler to the "submit" JavaScript event, or trigger that event on an element.
Parameters
handler(Function, optional): A function to execute when the event is triggered. If omitted, the event is triggered manually.
Returns
- (jBase): Current instance.
Example
$('#myForm').submit(function(e) {
e.preventDefault();
// Validate form...
});
.change
Description Bind an event handler to the "change" JavaScript event (fires when value is committed), or trigger it.
Parameters
handler(Function, optional): Function to execute.
Returns
- (jBase): Current instance.
Example
$('select').change(function() {
console.log('New selection: ' + $(this).val());
});
.input
Description Bind an event handler to the "input" JavaScript event (fires immediately when value changes), or trigger it.
Parameters
handler(Function, optional): Function to execute.
Returns
- (jBase): Current instance.
Example
$('#search').input(function() {
console.log('Typing: ' + $(this).val());
});
.focus
Description Bind an event handler to the "focus" JavaScript event, or trigger it.
Parameters
handler(Function, optional): Function to execute.
Returns
- (jBase): Current instance.
Example
$('input').focus(function() {
$(this).addClass('focused');
});
.blur
Description Bind an event handler to the "blur" JavaScript event (lost focus), or trigger it.
Parameters
handler(Function, optional): Function to execute.
Returns
- (jBase): Current instance.
Example
$('input').blur(function() {
$(this).removeClass('focused');
});