Ask A Question

Notifications

You’re not receiving notifications from this thread.

Action listener for submit on return??

Stephanie Couto asked in General

How would I make this code (that refers to a select box: https://developer.snapappointments.com/bootstrap-select/examples/) submit the selection by pressing the return key?

function sample_function() {
$('select_box').on('changed.bs.select', function (e, clickedIndex, isSelected, previousValue) {

});
}

Reply

You can listen on keydown event and detect when return is pressed and call the function. More on keydown event here https://developer.mozilla.org/en-US/docs/Web/API/Document/keydown_event

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 85,376+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.