Add placeholder feature to auto-populate data table

This commit is contained in:
Takumi
2013-07-31 18:06:57 +10:00
parent b355a7bb4c
commit 5809170073
6 changed files with 49 additions and 22 deletions

View File

@@ -22,7 +22,13 @@ jQuery(document).ready(function($){
// Data table checkboxes
$('.sp-data-table tr input[type=checkbox]').change(function() {
$(this).closest('tr').find('input[type=text], input[type=number]').prop('readonly', $(this).prop('checked'));
$el = $(this).closest('tr').find('input[type=text], input[type=number]');
$el.prop('readonly', $(this).prop('checked'));
if($(this).prop('checked')) {
$el.each(function() {
$(this).val($(this).attr('placeholder'));
});
}
})
// Uncheck auto to edit