i have a checkbox that when i check it,it redirects to another function as follows
function Allchecks1(event) {
event.stopPropagation();
var market = $(event.target).closest('a');
var destination = market.attr('data-destination');
if ((destination == 'null' || destination == 'local') && market.attr('dataid')) {
var id = market.attr('dataid');
navigateToEvent(id); // passes the id to this function
return true;
}
else if (!$('cb').is(':checked')) {
alert("owiedjiej"); //did a test when i uncheck the textbox nothing happends
}
}
function navigateToEvent(id) {
var url = '/' + 'List/events/';
if (id)
url += id;
}
the above passes the Id to navigateToEvent function so the output for example is as follows,
/List/events/1111
what i am trying to achieve is that when i untick the check box the id should be removed and my expected output should be
/List/events/
How do i achieve this? i added an alert just for testing purposes on the unticking of the checkbox and it doesnt fire any alerts.
html
<li "><a data-destination="local" dataid="' + this.MarketID + '" data-nodeid = "' + this.NodeId + '" ><span><input type="checkbox" id="cb" onclick=Allchecks1(event);></span></a></li>');
Aucun commentaire:
Enregistrer un commentaire