jQuery('.pricefield select','.pricefield input').each
(jQuery(this).change (function (){
alert(jQuery(this).attr("type")); //it give undefined
alert(jQuery(this).is(':input')); //it gives false
var allInputs = jQuery(":input");
alert(allInputs.attr('type')); //it gives hidden
get_sum();
}
));
How can I can identify the field type as select
or radio
or checkbox
?
jQuery('select, input', '.pricefield').on('change', function () {
var tag = $(this).prop('tagName'); // return "select", "input" etc
var type = $(this).prop('type'); // return "radio", "checkbox" etc
});