2

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+"' />";
}
2
  • What is the element that you want to disable .. the class belongs to an image .. is this image in an anchor tag? Commented Mar 5, 2014 at 10:58
  • Did you upvote my answer? Commented Mar 5, 2014 at 11:57

1 Answer 1

4

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.

Sign up to request clarification or add additional context in comments.

8 Comments

i am looking for the same, the button class is "button_add" which is declared in the plugin not in my local class.if i use with ur answer its not working :( , can you see the above code and tell me how to disable that button or image..???
when do you want the images to be disabled .. just give in id to the element and disable it.
i have to disable it dynamically in other js file, i tried to disable like this: $('.button_add').prop("disabled",true);
@Rajsekhar : Sometimes prop may not be supported in previous jquery versions and cause errors, so to disable try $('.button_add').attr("disabled", true);
try $('.button_add').attr("disabled", true); @Gaurav123 : +1
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.