如何删除 Zend 中默认选中的单选按钮 [英] How to remove radio button default checked in zend

查看:36
本文介绍了如何删除 Zend 中默认选中的单选按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我正在尝试删除 radio 按钮的默认选中值

HI guys i am trying to remove the default checked value for radio button

这是我的代码:

 <?php if ($this->isAllowed('order.customer.ticket-details')) : ?>
<fieldset class="order-obv-ticket">
    <legend><?php echo $this->translate('order_obv_ticket'); ?></legend>
    <div id="order-ticket-details"></div>
</fieldset>
<?php endif;?>

这是我的js函数:

    function getOrderTicketDetails(orderId, contactId)
    {
        $.ajax({
            url: vbdURL+'/order/customer/ticket-details',
            data:{orderId : orderId,
                  contactId :  contactId },
            type: 'POST',
            success:function(response){
                $('#order-ticket-details').html(response);
                if(null != order['requestTicketId']){
                    $("#ticketId-"+ order['requestTicketId']).prop('checked', true);
                } else {
                    if (0 < $("input[id^='ticketId-']").length) {
                        $("input[id^='ticketId-']:first").prop('checked', true);
                        order['requestTicketId'] = $("input[id^='ticketId-']:first").val();
                    } 
                }
            }
        });

}

这是我的单选按钮:

<span class="actions">
<input name="ticketId" id="ticketId-{{ticketId}}" type="radio" class="selectAll js-set-order-ticket" value="{{ticketId}}"/>

谁能帮助我如何取消选中默认单选按钮.

Can anyone help me how can i make default radio buttons should be unchecked.

提前致谢.

推荐答案

我已通过更改此行解决了我的问题

I Have solved my problem by chaging this line

$("input[id^='ticketId-']:first").prop('checked', true);

$("input[id^='ticketId-']:first").prop('checked', false);

这篇关于如何删除 Zend 中默认选中的单选按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆