Javascript 如何在表单中显示/隐藏模型?
在我的项目页面中,加载模型弹出窗口将出现,如果登录用户可以使用任何项目,则可以显示其他方式,但不显示在该模型中我有两个锚定标记 我的项目 添加新项目 “我的项目”菜单单击一个表格1是否会显示 添加新项目菜单单击第二个form2将显示 以下是我的型号代码:Javascript 如何在表单中显示/隐藏模型?,javascript,jquery,html,ajax,Javascript,Jquery,Html,Ajax,在我的项目页面中,加载模型弹出窗口将出现,如果登录用户可以使用任何项目,则可以显示其他方式,但不显示在该模型中我有两个锚定标记 我的项目 添加新项目 “我的项目”菜单单击一个表格1是否会显示 添加新项目菜单单击第二个form2将显示 以下是我的型号代码: <div class="modal-body"> <h2 class="text-uppercase text-center m-b-30"> <a href="index.html" class="t
<div class="modal-body">
<h2 class="text-uppercase text-center m-b-30">
<a href="index.html" class="text-success">
<span>All Projects</span>
</a>
</h2>
<a href="#" id="mp"> <i class="mdi mdi-account md-18"></i> My Projects</a>
<a href="#" id="anp"> <i class="mdi mdi-plus md-18"></i> Add New Project </a>
<form class="form-horizontal" action="#" id="myprojects">
<div class="form-group m-b-25">
<div class="col-xs-12">
<label for="username">Name</label>
<input class="form-control" type="email" id="username" required="" placeholder="Michael Zenaty">
</div>
</div>
<div class="form-group m-b-25">
<div class="col-xs-12">
<label for="emailaddress">Email address</label>
<input class="form-control" type="email" id="emailaddress" required="" placeholder="john@deo.com">
</div>
</div>
<div class="form-group m-b-25">
<div class="col-xs-12">
<label for="password">Password</label>
<input class="form-control" type="password" required="" id="password" placeholder="Enter your password">
</div>
</div>
<div class="form-group m-b-20">
<div class="col-xs-12">
<div class="checkbox checkbox-custom">
<input id="checkbox11" type="checkbox" checked>
<label for="checkbox11">
I accept <a href="#">Terms and Conditions</a>
</label>
</div>
</div>
</div>
<div class="form-group account-btn text-center m-t-10">
<div class="col-xs-12">
<button class="btn w-lg btn-rounded btn-lg btn-primary waves-effect waves-light" type="submit">Sign Up Free</button>
</div>
</div>
</form>
<form class="form-horizontal" action="#" id="addnewprojects">
<div class="form-group m-b-25">
<div class="col-xs-12">
<label for="username">Name</label>
<input class="form-control" type="email" id="username" required="" placeholder="Michael Zenaty">
</div>
</div>
<div class="form-group m-b-25">
<div class="col-xs-12">
<label for="emailaddress">Email address</label>
<input class="form-control" type="email" id="emailaddress" required="" placeholder="john@deo.com">
</div>
</div>
<div class="form-group m-b-25">
<div class="col-xs-12">
<label for="password">Password</label>
<input class="form-control" type="password" required="" id="password" placeholder="Enter your password">
</div>
</div>
<div class="form-group m-b-20">
<div class="col-xs-12">
<div class="checkbox checkbox-custom">
<input id="checkbox11" type="checkbox" checked>
<label for="checkbox11">
I accept <a href="#">Terms and Conditions</a>
</label>
</div>
</div>
</div>
<div class="form-group account-btn text-center m-t-10">
<div class="col-xs-12">
<button class="btn w-lg btn-rounded btn-lg btn-primary waves-effect waves-light" type="submit">Sign Up Free</button>
</div>
</div>
</form>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
我的jQuery代码:
<script type="text/javascript">
$(document).ready(function() {
$("#myprojects").hide();
$("#mp").click(function(e) {
$("#myprojects").show();
$("#mp").hide();
});
});
$(document).ready(function() {
$("#addnewprojects").hide();
$("#anp").click(function(e) {
$("#addnewprojects").show();
$("#anp").hide();
});
});
</script>
我的目的是单击哪个菜单,该表单将显示在模型中现在需要添加add$document.ready两次,并添加两个隐藏和显示工作片段。运行工作示例的代码段
$myprojects.hide;
$mp.ClickFunction{
$myprojects.show;
$addnewprojects.hide;
//$this.hide;
$anp.show;
};
$anp.ClickFunction{
$addnewprojects.show;
$myprojects.hide;
//$this.hide;
$mp.show;
};
名称
电子邮件地址
暗语
我接受
免费注册1
名称1
电邮地址1
暗语
我接受
免费注册[添加新项目]
在“加载我的项目”页面上显示,但在我的本地主机上,它将运行Add New Project@shreeon load。首先,我将看到“我的项目”页面,然后单击“添加新项目”,然后单击“新建项目”页面显示,在顶部还可以看到两个菜单“删除$this.hide”;在加载时显示两个菜单及其“查看我的项目”。