I have a button in html
<input id="LockUnlock"
type="submit"
class="btn-sm btn-primary"
value="@(agent.IsLockedOut ? "Unlock" : "Lock")"/>
It correctly sets the value based on the model but I want to toggle the button text when I click it.
My Javascript:
<script type="text/javascript">
$('input[type = submit]').click(function () {
if ($(this).text() === "Lock")
{
$(this).text("Unlock");
}
else
{
$(this).text("Lock");
}
});
</script>
Nothing happens when I click the button. I'm not seeing errors in the console window in Chrome.