Tell me, pliz, how to write JavaScript
code so that all absolutely forms on the page are sent with a key combination, besides clicking a button with a mouse.
All we have is the presence of the <form> tag on the page.
Ps. CMS - InstantCMS
Added by
When pressed, the function is called:
function sendMessage(){ var to_id = $('select#to_id').val(); var to_all = $('input[name=massmail]:checked').length; var to_group = $('input[name=send_to_group]').val(); if (to_id > 0 || to_all == 1){ if (to_all==1 || to_group==1){ to_id = 1; } var action = '/users/'+to_id+'/sendmessage.html'; $('form#newmessage').attr('action', action).trigger("submit"); } else { $('input#gosend').attr('disabled', 'disabled'); } }
Onclick Submission. This is where personal messages are sent. But on the comments, this function is not called, but still the page reloads.
Updated
In fact, the problem with the reload was that the action attribute in all forms is empty. That is, before submitting, he needs to set an action-URL. In this case, everything works.