I have a page that uses jquery to autosave a form (to mysql db) using the code below
<script type='text/javascript'>
$(function() {
getDatabase();
$('input,select,textarea').autosave({
url: 'update_name_etc_autosave.php',
method: 'post',
grouped: true,
success: function(data) {
$('#message p').html('Data updated successfully').show();
setTimeout('fadeMessage()',1500);
getDatabase();
},
send: function(){
$('#message p').html('Sending data....');
},
dataType: 'html'
});
});
function getDatabase(){
$.get('autosave_name_etc.php', function(data) {
$('#database').html(data);
});
}
function fadeMessage(){
$('#message p').fadeOut('slow');
}
This works fine when there is only one record. However in about half the records have two records. This then loops through and creates two forms on the same page. When this happens the autosave only works for the second form
How do I create two instances of the script or what do I need to rename dynamically in the script that will enable the autosave to work on both forms?
I am very much not an expert with jquery or javascript so if you could spell it out in layman's terminology would be much appreciated. thanks in advance.