how can i change the text of a button when clicked? and change it back when clicked again? i have this javascript i made.and its not giving me what i want.please help?
$('#addbtn').click(function (){
if(document.getElementById('addMat').style.display == "none"){
document.getElementById('addMat').style.display= "inline";
$(this).val('Cancel');
}else
document.getElementById('addMat').style.display= "none";
$(this).val('Add Material');
});