开发者社区> 问答> 正文

用jquery 对submit判断disabled状态

<form>
<div class="attribute_value back">
<input name="id[4]" type="hidden" id="attrib-4" />
<div id="tips_4" class="tips"></div>
<ul id="list_4" class="list_attribute">
<li id="value_50" class="list_name_id_4" rel="50"><span id="valule_text_50">100</span></li>
<li id="value_11" class="list_name_id_4" rel="11"><span id="valule_text_11">48</span></li>
<li id="value_12" class="list_name_id_4" rel="12"><span id="valule_text_12">50</span></li>
<li id="value_13" class="list_name_id_4" rel="13"><span id="valule_text_13">52</span></li>
<li id="value_14" class="list_name_id_4" rel="14"><span id="valule_text_14">54</span></li>
<li id="value_28" class="list_name_id_4" rel="28"><span id="valule_text_28">56</span></li>
<li id="value_29" class="list_name_id_4" rel="29"><span id="valule_text_29">58</span></li>
<li id="value_30" class="list_name_id_4" rel="30"><span id="valule_text_30">60</span></li>
<li id="value_31" class="list_name_id_4" rel="31"><span id="valule_text_31">62</span></li>
<li id="value_32" class="list_name_id_4" rel="32"><span id="valule_text_32">64</span></li>
<li id="value_33" class="list_name_id_4" rel="33"><span id="valule_text_33">66</span></li>
<li id="value_34" class="list_name_id_4" rel="34"><span id="valule_text_34">68</span></li>
<li id="value_35" class="list_name_id_4" rel="35"><span id="valule_text_35">70</span></li>
<li id="value_36" class="list_name_id_4" rel="36"><span id="valule_text_36">72</span></li>
<li id="value_37" class="list_name_id_4" rel="37"><span id="valule_text_37">74</span></li>
<li id="value_38" class="list_name_id_4" rel="38"><span id="valule_text_38">76</span></li>
<li id="value_39" class="list_name_id_4" rel="39"><span id="valule_text_39">78</span></li>
<li id="value_40" class="list_name_id_4" rel="40"><span id="valule_text_40">80</span></li>
<li id="value_41" class="list_name_id_4" rel="41"><span id="valule_text_41">82</span></li>
<li id="value_42" class="list_name_id_4" rel="42"><span id="valule_text_42">84</span></li>
<li id="value_43" class="list_name_id_4" rel="43"><span id="valule_text_43">86</span></li>
<li id="value_44" class="list_name_id_4" rel="44"><span id="valule_text_44">88</span></li>
<li id="value_45" class="list_name_id_4" rel="45"><span id="valule_text_45">90</span></li>
<li id="value_46" class="list_name_id_4" rel="46"><span id="valule_text_46">92</span></li>
<li id="value_47" class="list_name_id_4" rel="47"><span id="valule_text_47">94</span></li>
<li id="value_48" class="list_name_id_4" rel="48"><span id="valule_text_48">96</span></li>
<li id="value_49" class="list_name_id_4" rel="49"><span id="valule_text_49">98</span></li>
</ul>
</div>
<br class="clearBoth" />
</div>
<input type="submit" value="add to cart" alt="Add to Cart" title=" Add to Cart " id="cartbutton" class="btnAddToCart" align="absmiddle" /> 
</form>

请问大侠们,要是上面li没有选择的话,你们input的submit 就是disabled状态,当有选择的话,就取消disabled状态,这样的JQ要如何写哦?

展开
收起
a123456678 2016-07-13 10:45:45 2068 0
1 条回答
写回答
取消 提交回答
  • <script type="text/javascript">
        $(document).ready(function() {
            // body...
            $('.list_name_id_4').click(function(){
                var submit = $('#cartbutton');
                submit.attr('disabled',false);
            })
             
        });
    </script>
    2019-07-17 19:55:25
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关课程

更多

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载