Tanya Nayak
Tanya Nayak

Reputation: 3

Disable(readonly) a checkbox which in inside a Jquery DataTable

I'm quiet new to Jquery and working on an MVC project. I'm getting data from the DB and displaying it in a Jquery DataTable. I have checkbox column inside the DataTable.I set the value of the checkbox depending upon the value of Status which is one of the fields of my table. I want to make it readonly checkbox.In other words I want
to disable it. Here's the code where I'm setting the value of checkbox depending upon the value of Status(one of the fields) from the table.

{
                "targets": -3,
                "data": null,
                "render": function (data, type, full, meta) {
                    return data.Status== true ? '<input type=\"checkbox\" name="chk1" checked value=' + data.Status + '>' : '<input type=\"checkbox\" name="chk2"  value=' + data.Status+ '>';
                }
            }

Please help me to disable the checkbox.

Upvotes: 0

Views: 3532

Answers (1)

roullie
roullie

Reputation: 2820

just add disabled to the checkbox you want to disable.

<input type="checkbox" disabled />

Upvotes: 1

Related Questions