jeudi 13 juin 2019

Plotting appended checkbox problem to HTML table in mvc view

Here's my code, I am trying to append the dropdownlist textbox & checkbox to the HTML table but no idea why only checkbox is causing problems with plotting on the page.

 $.ajax({
                    type: "POST",
                    url: "/Group/FillMembers",
                    data: { GroupName: $("#ddlGroup option:selected").text().trim() },
                    success: function (response) {
                        $.each(response.message, function (key, value) {
                            var arr = value.split(";")
                            var tbody = $("#tbody");
                            var tr = $("<tr></tr>")
                            $.each(arr, function (i, obj) {
                                var temp = arr[i].trim().split("=")[1];
                                var td = $("<td></td>")
                                td.append(temp);
                                tr.append(td);
                            })
                            // DropDownlist for required adjustments
                            tr.append("<td><select id='ddlReqdAdjustment'> \
                                        <option>Keep</option> \
                                        <option>Remove</option> \
                                        <option>Remove After</option> \
                                    </select> \
                                </td>");
                            //Textbox with Validation to allow only integers
                            tr.append("<td><input type='text' \
                                            onkeypress = 'return (event.charCode != 8 && event.charCode == 0 \
                                                                    || (event.charCode >= 48 && event.charCode <= 57))' /> \
                                </td >");
                            tr.append($('<input />', { 'class':'col-lg-12', 'type': 'checkbox', 'name': 'check' }));
                            tbody.append(tr);
                        });

enter image description here

If I use any other component it is plotting in the last column but checkbox is plotting as shown in the image. No idea what is the problem. Found this little checkbox when I zoomed out on the page.




Aucun commentaire:

Enregistrer un commentaire