vb.net - jquery doesn't recognize dynamically created elements -
vb.net - jquery doesn't recognize dynamically created elements -
i able generate list of products checkboxes through vb , adding <ul>
tag
<input type="text" id="searchtext" /> <input type="button" value="search" id="wesearch" /> <div> <ul runat="server" id="ulval" style="list-style-type:none"/></ul> </div> dim brandname string dim brandid integer dim build new stringbuilder() dim msql new mysqlconnection() msql.connectionstring = "server=192.168.1.230;database=cable_tv_reporting1;uid=root;pwd=master!!@" msql.open() select case msql.state case system.data.connectionstate.open exit select case system.data.connectionstate.closed response.write("connection closed") exit select case else exit select end select dim cmd new mysqlcommand("select brandid, brandname cap_brand isactive=1;", msql) dim reader mysqldatareader = cmd.executereader() while reader.read() brandid = convert.toint32(reader(0)) brandname = reader(1).tostring() build.append("<li><input type='checkbox' name ='brands' id='" & brandid & "' value='" & brandid & "'/><label for='" & brandid & "'>" & brandname & "</label></li>") end while ulval.innerhtml = build.tostring()
the problem jquery not recongize html have generated dynamically
$('document').ready(function () { $('#wesearch').on('click', function () { var counted = 0; var boxes = $('#ulval').find(':checkbox'); boxes.each(function () { counted++ ; }); alert(counted); }); });
the result 0 instead of actual number of products. how can prepare this
i solved issue, turns out had @ generated html. id of ul
changing because of tab container. give thanks helping
jquery vb.net
Comments
Post a Comment