However, if I click the second input, this displays the correct date in the input, but when I click the update button to trigger the alert and display the value, the value that is returned is the value of input 1.
All I am trying to do is, get the value of each input on the click event.
I would be grateful if someone could shed some light as to where I have gone wrong as I am still learning JTable and jQuery. Many thanks.
$(function() {
$(document).ajaxSuccess(function() {
$("input[name=MyName]").datepicker({
changeMonth: true,
changeYear: true,
yearRange: '2011:2037',
dateFormat: 'dd/mm/yy',
minDate: 0,
defaultDate: null
});
});
//Prepare jTable
$('#setDestScheduleShow').jtable({
title: 'Box Destruction Schedule',
paging: true,
pageSize: 5,
pageSizes: [5, 10, 25, 50, 100, 250, 500],
messages: {
pagingInfo: 'Showing {0} to {1} of {2} records',
editRecord: 'Edit Box Record'
},
sorting: true,
defaultSorting: 'destroy_date ASC',
actions: {
listAction: 'destroySchedDisp.php?action=list',
//createAction: '../users/destroySchedDisp.php?action=create',
//updateAction: '../users/destroySchedDisp.php?action=update',
//deleteAction: '../users/destroySchedDisp.php?action=delete'
},
fields: {
Id: {
key: true,
title: 'Id',
width: '2%',
list: false
},
customer: {
title: 'Co Ref',
width: '10%',
list: false
},
intake_date: {
title: 'Intake Date',
width: '14%',
type: 'date',
displayFormat: 'dd/mm/yy'
},
destroy_date: {
title: 'Destroy Date',
width: '14%',
type: 'date',
displayFormat: 'dd/mm/yy'
},
custref: {
title: 'Box No',
width: '14%'
},
amend: {
title: 'Amend Date',
width: '12%',
sorting: false,
visibility: 'visible',
type: 'date',
display: function() {
return "<input class='' type='text' name='amend'>";
}
},
sendbtn: {
title: 'Update',
width: '12%',
sorting: false,
display: function(data) {
var $button = $('<input type="button" class="destBtn" name="destUpdBtn" value="Update" />');
$button.click(function() {
var $temp = $('input[name="amend"]').val();
alert($temp);
}
});
return $button;
}
}
}
});
$('#setDestScheduleShow').jtable('load');
});
This post has been edited by Mr_P: 25 October 2014 - 05:12 AM

New Topic/Question
Reply


MultiQuote


|