I developed the following code that I use in the context of submitting forms using AJAX. This is not exactly your case, but the same code will make your value <input type="submit"> :
function submit_click() { var $input = $(this); var name = $input.attr('name'); if (typeof name == 'undefined') return; var value = $input.attr('value'); var $form = $input.closest('form'); var $hidden = $('<input type="hidden" />').attr('name', name).attr('value', value); $form.find('input[type=hidden][name="' + name + '"]').remove(); $form.append($hidden); }; $(document).on('click', 'form.ajax input[type=submit]', submit_click);
I use class="ajax" in the form element to activate this code. You can change according to your needs.
What is he doing? It creates a hidden form input with the same name and value as the clicked input input. So, when the message occurs programmatically later, the value is correctly represented.
And, you asked what could be preventing value from being passed ... the validation plugin latches the form submission and performs its actions. After verification, this initiates the submission of the form. When this happens, it is not the element of the <input> element that triggers the submission of the form anymore. This is the JavaScript plugin code. Thus, the event " <input> " is lost. That is why it is not represented. (Does it make sense? If this explanation is poorly written, let me know.)
source share