javascript - 禁用页面上的按钮
问题描述
我有以下登录页面
当我单击创建帐户时,再次显示员工登录按钮。
我如何从这个页面中删除它?
按钮是相同的,并显示在两个页面上?
我不希望该按钮显示在“创建帐户”页面上。
这是jsfiddle
$("#form-id").submit(function()
{setTimeout(function(){
alert("Thank you for requesting an Documentation Center account. Once your request is reviewed by an administrator, you will receive an email with your login credentials."); location.reload();
submit = true;}, 1000);
});
<div class="company-logo-container1">
<a href=(site.uri)><img src=(site.uri & '/@api/deki/files/12133/Acc_Logo_Black_Purple_RGB.png?origin=mt-web' & {default: wiki.cdn('/skins/styles/elm/logo.svg')})/></a>
</div>
<div id="title-container">
<div class="login-title"> "ALIP CLIENT PORTAL"; <span class="name">"& DOCUMENTATION CENTER"</span></div>
/*<p id="login-paragraph"> "Supporting our customers by providing documentation for ALIP." </p>*/
</div>
<div id="acc-login-panel">
<div id="employee-login">
//<div id="login-subheader">'ALIP Employees'</div>
//<p class="employee-text">'ALIP Employees: '</p>
<form id="registerform" method="link" action="https://acclife-prod.mindtouch.us/Special:SAML?returnto=https://acclife-prod.mindtouch.us">
<button type="submit" name="deki_buttons[action] [login]" value= "Sign In" class="ui-button ui-button-primary" tabindex="3"><span>'Employee Sign In'</span></button>
</form>
</div>
<div id="customer-header">'Customers and Partners'</div>
<div id="customer-login">
<a id="acc-register">
<input id="showbutton" onclick="
//$('#customer-login').hide();
$('#mt-login-form').hide();
$('#login-subheader').hide();
$('#widget-login-panel').hide();
$('#acc-password').hide();
$('#acc-register').hide();
$('#showbutton').hide();
$('#accountrequest').show();
$('#hidebutton').show();"
readonly="true"
type="text"
value="Create an Account" />
</a>
<a id="acc-password">
<input id="resetbutton" onclick="
//$('#customer-login').hide();
$('#mt-login-form').hide();
$('#login-subheader').hide();
$('#widget-login-panel').hide();
$('#acc-password').hide();
$('#acc-register').hide();
$('#showbutton').show();
$('#accountrequest').hide();
$('#acc-login-panel').hide();
$('#employee-login').hide();
$('#hidebutton').show();
$('#acce-password-panel').show();
$('#widget-password-panel').addClass('widget-panel show active-panel');"
readonly="true"
type="text"
value="Reset Your Password" />
</a>
<div id="accountrequest" style="">
<div id="frame-container" >
<div>template('Custom/LoginForm');</div>
</div>
<br />
<input id="hidebutton" onclick="
$('#customer-login').show();
$('#mt-login-form').show();
$('#login-subheader').show();
$('#widget-login-panel').show();
$('#acc-password').show();
$('#acc-register').show();
$('#showbutton').show();
$('#accountrequest').hide();
$('#hidebutton').hide();"
readonly="true"
style="display:none; border:none;color:#000;font-size:1.0em;cursor:pointer;"
type="text" value="Return to Login"/>
</div>
</div>
</div>
<div id="acc-password-panel">
<div id="customer-password-header">'Customers and Partners'</div>
<div id="password-contents">
<div id="loginReturn"><a href="/Special:Userlogin">'Return to Login'</a></div>
<div id="contactSC"><a href="mailto:ALIPDocumentationCenter@act.com">'Contact the Documentation Center'</a></div>
</div>
</div>
解决方案
因为您永远不会隐藏在click
输入的属性中。
<input id="showbutton" onclick="
//$('#customer-login').hide();
$('#mt-login-form').hide();
$('#login-subheader').hide();
$('#widget-login-panel').hide();
$('#acc-password').hide();
$('#acc-register').hide();
$('#showbutton').hide();
$('#accountrequest').show();
$('#hidebutton').show();"
readonly="true"
type="text"
value="Create an Account" />
顺便说一句,避免使用 JavaScript 更改整个页面。不要隐藏元素,只需更改页面。如果用户不允许使用 JavaScript 或浏览器版本较旧,则可能会破坏您的逻辑。
推荐阅读
- cloudflare - Cloudflare 工作器重定向
- php - 为什么 HTTP OPTIONS 请求在 PHP-FPM 上不起作用?
- flutter - 在构建 StreamBuilder 时引发了以下 NoSuchMethodError
- javascript - 我的纯 js 水平滚动不会激活滚动捕捉
- reactjs - ReactJS 路由 onEnter 替换问题
- discord - 机器人在字符串中只说一个单词
- mysql - 从 mysql 复制到 Tarantool 时出现此错误,这些是复制器日志
- parsing - 删除文件路径并使用文件编号在绘图时执行一些计算
- r - 取消嵌套时将元素名称添加到单独的列中
- python - Matplotlib Animation FuncAnimation - 标题和副标题将被移动