开发者

Adding a radio button dynamically using Jquery (Onclick of a button)

开发者 https://www.devze.com 2023-03-27 05:53 出处:网络
I ve one dropdownlist & t开发者_如何学JAVAwo textboxes. Once I fill them, (on click of a button) I want to append them in a table row dynamically along with a radio button as the third column.

I ve one dropdownlist & t开发者_如何学JAVAwo textboxes. Once I fill them, (on click of a button) I want to append them in a table row dynamically along with a radio button as the third column.

The below code is working, but not sure why the onclick event of radio button is not responding. I am using MVC 3.0.

    function Contact_OnAddTelephone() {
    var type = $("#rdoTelephoneType").val();
    var areaCode = $("#txtAreaCode").val();
    var number = $("#txtNumber").val();

    var radio = $('<input>').attr({
        type: 'radio', id: 'rdoTelePrimary', name: 'rdoTelePrimary'
    });
    $('#tableTelephone tr:last').after("<tr><td>" + type + "</td><td>" + areaCode + "-" + number + "</td><td>" + radio[0].outerHTML + "</td></tr>");
}
0

精彩评论

暂无评论...
验证码 换一张
取 消