I have a simple page with three check box with the auto populate the data by jQuery and the fourth one has no data(empty).
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="MasterPageWithHTMLInput.aspx.cs" Inherits="Test_WSMS_TV.MasterPageWithHTMLInput" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
// alert('akash');
$(document).ready(function() {
var arr = ["val1", "val2", "val3"];
$('#check label').each(function(index) {
if (index < arr.length)
$(this).text(arr[index]);
});
});
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div class="container" id="check">
<input type="checkbox" id="CheckBox3" runat="server" />
<label>
</label>
<input type="checkbox" id="CheckBox4" runat="server" />
<label>
</label>
<input type="checkbox" id="CheckBox5" runat="server" />
<label>
</label>
<input type="checkbox" id="CheckBox6" runat="server" />
<label>
</label>
</div>
</asp:Content>
I want to hide the Check box and label which has no data (fourth one) by jQuery.
<input type="checkbox" id="CheckBox6" runat="server"/>
<label>
</label>
how can i do it by jQuery?