Have a basic link that I am using as a button and changing the text when the user clicks it to go from edit to done editing. When I first click the button, the click event happens but the text does not change until I click it again which is throwing off and not behaving as I would like:
HTML:
<a type="button" id="editButton" class="editButton" style="cursor: pointer">EDIT</a>
JS:
$("#editButton").click(function () {
var $this = $(this);
$this.toggleClass('editButt');
if ($this.hasClass('editButt')) {
$this.text('EDIT');
} else {
$this.text('DONE EDITING');
}
});