【发布时间】:2014-01-30 10:43:39
【问题描述】:
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();
}
));
如何将字段类型识别为select 或radio 或checkbox?
【问题讨论】:
-
该语法看起来不正确,
.each需要回调,但您正在传递一个 jQuery 集合。你能发布一个演示来重现这个问题吗?
标签: javascript jquery select input radio