CHECKBOX、SELECT、TEXT的选择、禁用、赋初值

版权声明:本文为博主原创文章,未经博主允许不得转载,如果转载,我也不是很介意。 https://blog.csdn.net/qq_34926773/article/details/79826238

input

checkbox:<input type="checkbox" name="checkbox1" id="checkbox1" />

  选择器 :$("inout: checkbox");

                 $("inout[type='checkbox']");

                 $("inout[name='checkbox1']");

                 $("#checkbox]");

     禁用: $("inout[type='checkbox']").prop("disabled",true);OR $("inout[type='checkbox']").prop("disabled","disabled",);

默认选中:$("inout[type='checkbox']").prop("checked","checked");

                 OR $("inout[type='checkbox']").prop("checked","true",);

======================================================================================

radio:<input type="radio" name="radio1" id="radio1" value="1"/>

  选择器 :$("inout: radio");

                 $("inout[type='radio']");

                 $("inout[name='radio1']");

                 $("#radio1]");

     禁用: $("inout[type='radio']").prop("disabled",true);OR $("inout[type='radio']").prop("disabled","disabled",);

默认选中:$("inout[type='radio']").prop("checked","checked");

                 OR $("inout[type='radio']").prop("checked","true",);

                 OR $("inout[type='radio']").val(1);

======================================================================================

text:<input type="text" name="text" id="text" />

  选择器 :$("inout: text");

                 $("inout[type='text']");

                 $("inout[name='text']");

                 $("#text]");

     禁用: $("inout[type='text']").attr("readonly",true);

默认值:$("inout[type='text']").val(1);


                



猜你喜欢

转载自blog.csdn.net/qq_34926773/article/details/79826238