Reputation: 3
html
<div id="ltrProducts" runat="server"></div>
<div id="a" runat=server style="display:none">abcd</div>
code
string contantProduct = "<div style='cursor:pointer;border:1px solid red' onclick=\"$(\'#a\').css('display','inline');\">does not see water else swimer good</div>";
ltrProducts.InnerHtml = contantProduct;
this code does not show div.a
but if remove runat='server'
show div.a
Upvotes: 0
Views: 3148
Reputation: 2459
When you using runat="server" in any tag, ASP.NET is going to hijack whatever id you set and change it to something like ct100_blah_blah_a. Do a View Source in your browser, and look at the actual HTML being output. Then grab the real id of your "a" element, and use that in the javascript.
Upvotes: 3