Mohd Abrar Ahmed Mohd Abrar Ahmed - 5 months ago 89
jQuery Question

By default in asp.net web forms it will have two aspNetHidden Divs, How do I remove that

When i create a empty webform page in asp.net it create the code like below:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="Threetier.WebForm1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>

</div>
</form>
</body>
</html>


additionally i added googleapis jquery in head tag using:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>


Now, this means that it has only one div in form and when I console the below code I should get object of one div:

$("#form1").find('div');


but the result is

Object[div.aspNetHidden, div.aspNetHidden, div ]

Answer

Try following code

$("#form1").find('div').not('.aspNetHidden');
Comments