当页面不刷新时, 多次操作某事件, live绑定的事件会触发多次, 用bind可避免:
$("#bt_send").live("click",function(){ var mobileSelectedUsers=''; $("#se_mobile_users").find('.ui-widget-content').each(function() { if(IsInteger(this.value)){ mobileSelectedUsers+=this.value+','; } }); $("input[name='mobile_user_ids']").attr("value", mobileSelectedUsers); //alert(mobileSelectedUsers); addedit_form_post.submit(); return false; });
$("#bt_send").bind("click",function(){ var mobileSelectedUsers=''; $("#se_mobile_users").find('.ui-widget-content').each(function() { if(IsInteger(this.value)){ mobileSelectedUsers+=this.value+','; } }); $("input[name='mobile_user_ids']").attr("value", mobileSelectedUsers); //alert(mobileSelectedUsers); addedit_form_post.submit(); return false; });