On clicking the link below, what I want is to change the onclick function like onclick="linkSubCategory(1, \'people\', \'1\', \'peopleLink\');" that is changing the third attribute to 1 from 0.
<a href="#" id="peopleLink" onclick="linkSubCategory(1, \'people\', \'0\', \'peopleLink\');" style="display: inline-block;"><img src="images/icons/group.png"></a>
For my above requirement I am using the code below but it is not working. Kindly suggest me a way to achieve my requirement.
function linkSubCategory(divID, divName, chkVal, linkID) {
$("#"+linkID).removeAttr("onclick");
$("#"+linkID).attr("onclick", "linkSubCategory("+divID+", '"+divName+"', '1', '"+ linkID +"')");}
$('#peoplelink').click(function(){divId=$(this).data('divId')...and set the chkval accordingly. This way you don't neeed to rewrite the handler , just the data attributes.