Java Learner
Java Learner

Reputation: 321

Disable button in jquery datatable

I am using jquery.dataTables.js plugin, with this i have created a double table where i can add the rows from one table to another table and remove vice versa.How can i disable the add and remove buttons.Please verify the image for more idea.

Here is the code that I tried:

$.fn.doubletable = function (opts) {    
var node_img_remove = "<img src='" + root + "images/"+theme+"ico_moove-down.png' class='button_remove' style='float:none; cursor:pointer;' title='"+titleRemove+"' alt='"+titleRemove+"' />";
var node_img_add = "<img src='" + root + "images/"+theme+"ico_moove-up.png' class='button_add' style='float:none; cursor:pointer;' title='"+titleAdd+"' alt='"+titleAdd+"' />";
}

Upvotes: 2

Views: 3809

Answers (1)

A J
A J

Reputation: 2140

If this button has a class apply the necessary style to disable these buttons on make it unclickable. This can be done with jQuery.

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="../JS/jQuery.js" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $('.disable').attr("disabled", true);
        //$('#Button1').prop("disabled", true);  //for disabling elemnt by id
    });
</script>
</head>
<body>

<asp:Button ID="Button1" class="disable" runat="server" Text="Button" />

</body>
</html>

Is this what you are looking for? This will disable the button element on load. Similarly you can call it whenever you need.

Upvotes: 4

Related Questions