Subscribe to Subscribers

Resources » Code Snippets » jQuery

How to enable and disable all control of page using jQuery?


Posted Date:     Category: jQuery    
Author: Member Level: Gold    Points: 20


In this article I have explained about How to enable and disable all control of page using jQuery. Each steps I have clearly explained in this article.



In this article I have explained about How to enable and disable all control of page using jQuery. Each steps I have clearly explained in this article .
jQuery provides (*) selector, which selects all the elements of the web page.
By using this selector we can enable or disable the web page controls. Herewith i have explained with simple example


<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<script src="jquery-1.2.6.js" type="text/javascript"></script>
<script type="text/javascript">

$(document).ready(function()
{
$("#Button1").toggle(function()
{
$("*").attr("disabled", "disabled");
$(this).val('Click me to enable');
$(this).attr("disabled", "");},

function()
{
$("*").attr("disabled", "");
$(this).val('Click me to disable');
});
});


</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" Text="Click me to disable" runat="server" />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<asp:HyperLink ID="HyperLink1" runat="server">HyperLink</asp:HyperLink>
</div>
</form>
</body>
</html>






Did you like this resource? Share it with your friends and show your love!


Responses to "How to enable and disable all control of page using jQuery?"

No responses found. Be the first to respond...

Feedbacks      

Post Comment:




  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Next Resource: How to manipulate dropdownlist using jQuery
    Previous Resource: How to disable right click event using jQuery
    Return to Resources
    Post New Resource
    Category: jQuery


    Post resources and earn money!
     
    More Resources
    Popular Tags   Tag posting guidelines   Search Tags  
    (No tags found.)

    Active Members
    TodayLast 7 Daysmore...

    Awards & Gifts
    Talk to Webmaster Tony John
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
    2005 - 2013 All Rights Reserved.
    .NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
    Articles, tutorials and all other content offered here is for educational purpose only.
    We are not associated with Microsoft or its partners.