I have two different forms which basically do the same thing so just for an ease of use and less coding is there any way I can assign both of them on one $(document).ready(function())
.
My original $(document).ready
looks like this :
$(document).ready(function() {
$("#transaction_form_new").on('submit', (function(e) {
e.preventDefault();
var formData = new FormData(this);
formData.append('farm', {{farm.id}});
$.ajax({ ... })
This one is for creating a new form and i want to add the 'edit_form' also. I tried it like this but with no result:
$(document).ready(function() {
$("#transaction_form_new"),$("#transaction_form_edit").on('submit', (function(e) {
As @freedomn-m suggested, the correct way to do that is:
$("#transaction_form_new, #transaction_form_edit").on
Both selectors inside a single string, using the comma selector