Wednesday, January 23, 2013



Find Element with javascipt/jquery


1. Find Element with java script

-document.getElementById("PassYourElementId]");
example-document.getElementById("divSample");


2. Find Element with java script(runat="server")

-document.getElementById("<%=PassYourElementId.ClientID %>")
example-document.getElementById("<%=txtSample.ClientID %>")

3. Find Element with jquery

-$("#PassYourElementId")

4. Find Element with jquery(runat="server")

-$('#<%PassYourElementId.ClientID%>')
example-$('#<%=chkhdrUser.ClientID %>')

5. Find Element with jquery using Element Type
(From this method you can find element from any page of your project)

-$('input[type="PassTypeOfElement"][id*="PassElementId"]')
example-$('input[type="hidden"][id*="hdnShowThis"]')

6. Find Element with jquery using Id

-$('a[id*="PassElementId"]')
example-$('a[id*="lnkUList"]')

7. Find element by css class in jquery
-<div class="menu">
$('.menu')

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.