I am trying to change/revert a text string when a link is clicked with Jquery. Now the first statement of this code works fine, but the the other one doesn't. Can someone please help figure out what's going wrong here?
<script>
$("document").ready(function(e) {
$("#newMessagelink").click(function(e) {
$("#new-msg").toggle();
if($("#newMessagelink").text("New Message") {
$("#newMessagelink").text("Back to Inbox");
} else if($("#newMessagelink").text("Back to Inbox")) {
$("#newMessagelink").text("New Message");
}
})
});
</script>
thanks!