javascript - Make anchor tags behave like checkboxes and radio buttons -
i have unordered list like: <ul class="list-one"> <li><a href="#">hip hop</a></li> <li><a href="#">country</a></li> <li><a href="#">pop</a></li> <li class="selected"><a href="#">religious</a></li> </ul> i want anchors behave checkboxes. have similar list , want checkboxes there behave radio buttons. is there way using jquery? searched google couldnt find anything. you can work jquerys parent() , siblings() methods. check jsfiddle demo radios ! jquery radio: $(".list-one a").click(function(){ $(this).parent().addclass("selected").siblings().removeclass("selected"); }); jquery checkboxes : $(".list-one a").click(function(){ $(this).parent().toggleclass('selected'); }); if need radios form, can use label instead of