i am trying to change color of the list on clicking anchor tag using jquery. On clicking the anchor tag i have called a C# function code behind.. if i give return false code in jquery like the below code the color has changed. but code behind function is not working. once i comment return false from jquery the code behind code is working but the color has not changed.
jquery code:
<ul class="ullist" id="navlist">
<li id="list1"><a id="a1" runat="server" onserverclick="lnkactive_click" style="width: 10px; position: relative">Active</a></li>
<li id="list2"><a id="a2" runat="server" onserverclick="lnkabeyance_click">Abeyance</a></li>
</ul>
Jquery code :
$(document).ready(function () {
$("a").click(function () {
$("li.active1").removeClass("active1");
$(this).parent('li').addClass('active1');
return false;
});
});
您将需要在代码的后面(“ lnkactive_click”中)进行颜色更改,因为回发将重新呈现HTML,从而丢失您在客户端所做的任何更改。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.