admin管理员组文章数量:1418112
I'm using twitter bootstrap and alert elements to use within my web page and I want to use this as validation summary towards the top section of my page.
The issue that I have is when I use "alert alert-danger" on my create.chstml page, this displayed the red warning bar by default when the page is loaded.
The actual validation works on the form fields they are supposed to, however, I just need to find a way of hiding this warning bar when the page loads and then get this to kick in when my create button has been clicked.
I have tried some of the bootstrap properties like Hidden:hidden but this doesn't seem to work. Can I use javascript to plete this task and link this to the button create I have?
Here is the bootstrap I have on my create.cshtml
<div class="form-horizontal">
<div class="row" >
<div class="alert">
@Html.ValidationSummary(false, " ", new { @class = "text-danger alert alert-danger" })
</div>
</div>
</div>
I'm using twitter bootstrap and alert elements to use within my web page and I want to use this as validation summary towards the top section of my page.
The issue that I have is when I use "alert alert-danger" on my create.chstml page, this displayed the red warning bar by default when the page is loaded.
The actual validation works on the form fields they are supposed to, however, I just need to find a way of hiding this warning bar when the page loads and then get this to kick in when my create button has been clicked.
I have tried some of the bootstrap properties like Hidden:hidden but this doesn't seem to work. Can I use javascript to plete this task and link this to the button create I have?
Here is the bootstrap I have on my create.cshtml
<div class="form-horizontal">
<div class="row" >
<div class="alert">
@Html.ValidationSummary(false, " ", new { @class = "text-danger alert alert-danger" })
</div>
</div>
</div>
Share
Improve this question
edited Dec 19, 2016 at 11:43
Hudhaifa Yoosuf
9192 gold badges13 silver badges28 bronze badges
asked Dec 19, 2016 at 11:31
Betty LazzariBetty Lazzari
991 gold badge6 silver badges13 bronze badges
1
- 1 dddddduplicate check out the answer here – George Commented Dec 19, 2016 at 11:34
1 Answer
Reset to default 2Just use the hide class of bootstrap and when you click on button you can remove that class.
<div class="form-horizontal">
<div class="row" >
<div class="alert hide"> //add class here
@Html.ValidationSummary(false, " ", new { @class = "text-danger alert alert-danger" })
</div>
</div>
</div>
It will hide the alert on the page load and will work on button click as you want.
本文标签: javascriptbootstrap alertdanger hide when page loadsStack Overflow
版权声明:本文标题:javascript - bootstrap alert-danger hide when page loads - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745280835a2651416.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论