7 January 2014

The element Selector in jquery




The jQuery element selector selects elements based on their tag names.
You can select all <p> elements on a page like this:
$("p") 

Example 

When a user clicks on a button, all <p> elements will be hidden: 

Example

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
    <script type="text/javascript">
            function f1() {
                $("p").hide();
            };
    </script>
</head>
<body>
    <form id="form1" runat="server">
 
        <p>
            hi</p>
        <p>
            This is adi</p>
        <br />
        <asp:Button ID="button" OnClientClick="f1(); return false" runat="server" Text="Click" />
   
    </form>
</body>
</html>

OUTPUT


 

No comments:

Post a Comment