I am trying to create a button called SignIn that accommodates browsers without javascript, but doesn’t navigate when Javascript is enabled.
<script type="text/javascript">
$(function () {
$("#signIn").click(function () {
//
// Stop event bubbling
//
return false;
});
});
// Gets the div tag and its content for an identity provider
function GetIdentityProviderTag(idp, index)
{
return '<div class="identity-provider" id="button' + index + '"><button>' + idp.Name + ' </button></div>';
}
</script>
<div>
<a href="/NoJavascriptSignIn" id="signIn">Sign In</a>
</div>
What do I need to do to permit both javascript enabled, and javascript disabled browsers to work?
The next code snippet prevents the browser from following the link (mainly
return false), you should remove it:If you just want to press the button automatically, use: