[jQuery] jeditable and checkboxes
I know that there's some information I'm missing here.
Been trying to get to Mike's site today but it seems it's down:
http://www.appelsiini.net/
I've put together an extension for doing checkboxes based on some
different stuff I have seen online and come up with the following that
I've added to the jeditable.js file at the end.
// Create a custom input type for checkboxes
$.editable.addInputType("checkbox", {
element : function(settings, original) {
var input = $('<input type="checkbox">');
$(this).append(input);
// Update <input>'s value when clicked
$(input).click(function() {
var value = $(input).attr("checked") ? 'Yes' : 'No';
$(input).val(value);
});
return(input);
},
content : function(string, settings, original) {
var checked = string == "Yes" ? 1 : 0;
var input = $(':input:first', this);
$(input).attr("checked", checked);
var value = $(input).attr("checked") ? 'Yes' : 'No';
$(input).val(value);
}
});
based on the new support in jeditable for onBlur I've added this:
onblur : \'submit\',
and am having luck saving the textbox change. I would like however to
return a checked checkbox if selected and an empty one if it's
deselected.
When I alter the jquery code in the script above to:
var value = $(input).attr("checked") ? '<input
type="checkbox" checked>' : 'No';
I get the checked box returned but the html is written to the table
row.
My question is this: What is the best way to "fork" this so that the
browser gets the html and I can write the value of yes or no to the
table?
Brian Loomis