jQuery多功能单选按钮

时间:2017-06-10 03:46:11

标签: jquery

很抱歉,如果之前有人问过这个问题,现在就搜索几天,并且在10年以上没有编码。

我尝试突出显示出货方法的第一个单选按钮(这样可以正常工作),但也用于payment_method。我使用单独的.js文件执行此操作,因为我根本无法访问结帐页面。

你可以在这里看到它们:

enter image description here

非常感谢任何帮助

付款源代码:

                <div id="gui-block-payment-method" class="gui-section gui-block gui-step gui-validate step-payment gui-inactive " data-name="payment" data-error="Selecteer een betaalmethode.">
                    <div class="gui-block-subtitle gui-bigger">Betaalmethoden</div>

  

除非没有数据刷新,否则发货情况类似:

$(document).ready(function(){

    $("input[name=shipment_method]").click(function(){

  setTimeout(function() {

        $("#gui-shipment-method").prop("checked",true) },1500);

  })

  $("input[name=shipment_method]").first().click()

})

1 个答案:

答案 0 :(得分:0)

你可以尝试

$(document).ready(function(){
    $("input[name=shipment_method]").click(function(){
       setTimeout(function() {
           $("#gui-shipment-method").prop("checked",true);
           $("#gui-payment-seoshoppayments-ideal").change();
       },1500);
    }).first().click();
 })

OR

<script>

虽然代码中有$(document).on('change', 'input[name="shipment_method"], input[name="payment_method"]', function() { var section = $(this).parents('.gui-section'); var parent = $(this).parents('[data-method]'); $(section).find('[data-subform]').hide(); parent.find('[data-subform]').show(); });

$(document).ready(function(){
    $("input[name=shipment_method] , input[name=payment_method]").first().change();
    // OR
    $("input[name=shipment_method] , input[name=payment_method]").first().prop("checked" , true).change();
});

代替您尝试的代码,您只需使用

即可
{{1}}
相关问题