I am creating a small CRM that has many AJAX-powered forms. I am trying to establish the best neutral data selection tool for getting all data for a form.
One issue I am having is that checkboxes always come up as "on" when doing $('#checkbox').val()
. My goal is to write 1 selection that will get all items that have data within them. My current selection statement is quite bare:
$('input, select, textarea').each( function() {
// do stuff with the data, and create a dataString
}
I have tried using :not()
, but what I really want to do is get ALL input tags that are NOT unchecked checkboxes. Is there some nested selector I can use? I know :checked
is always available, but I was trying to keep it as non-specific as possible. I know i could do:
$('input[type=text], input:checked, type[type=hidden] .... ')
And so on, but I'm looking to keep it nice and short (if possible!)
Thanks guys!