(By disable I mean remove the links without removing their contents and then enable - to retrieve the links)
I've read about wrap and replacewith, bind and unbind. But I can't seem to get it to work. Basically I have a button which I click in order to disable/enable the links. Here is the code I've worked so far:
var edit = false;
$('.courselink').click(function(e){ //the links
if(edit == true){
return false;
}
});
$('.vieweditlink').click(function(){ //This is the button
if($(this).html() == 'Edit'){
$(this).html('View');
edit = true;
}
else {
$(this).html('Edit');
edit = false;
}
});
Everything is in $(document).ready
of course
JSfiddle here: http://jsfiddle.net/ugkc8gsd/7/