var $field = $(this); if ($field.is('input')) { alert(1); if ($field.attr('type') == 'checkbox') { alert(2); if ($field.attr('value') == "true") return $field.attr('checked'); } return $field.val(); } I want to check if value of checkbox is true i add attribute checked = checked for checkbox. but my code is wrong. please help me.thanks