表单提交时问题总结

  $(":radio").removeAttr('checked');   

  $(":radio").attr('checked','true');   

  实际问题:在使用removeAttr()移除了radio的checked属性后,使用attr()重新增加不起作用;   

  解决:    $(":radio").removeAttr('checked');   

                 $("input:radio").prop('checked','true');      

  注意:具有 true 和 false 两个属性的属性,如 checked, selected 或者 disabled 使用prop(),其他的使用 attr().

 

使用下拉列表多选时,select的属性multiple=“multiple”,样式效果不能令人满意,可使用select2插件。

select2控件的使用

posted @ 2018-10-29 01:28  rqpjuicy  阅读(112)  评论(0编辑  收藏  举报