TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Guest User
Tech Writer
2.1k
473.4k
Borders of textbox are fading away when validated?
Mar 23 2020 4:39 AM
Hi Team
I have textbox and before a user leaves its been validated with label error message, now the problem is on the border itself its fading out with being empty in between error label message, who can assist me that this issue not showing this to a user.
<div
class
=
"row"
>
<div
class
=
"input-group col-md-4 col-md-offset-2 col-sm-2 col-xs-2"
>
<div
class
=
"input-group pull-right"
>
<label
for
=
"Email"
>Email:</label>
@Html.TextBoxFor(m => m.HomeMainModel.Email,
new
{
@
class
=
"form-control"
,
type =
"email"
,
id =
"inputEmail"
,
placeholder =
"Email address"
,
autofocus =
"autofocus"
})
<label id=
"labelMessage"
class
=
"text-danger"
style=
"display:none"
>This field
is
required</label>
<div
class
=
"input-group-append"
>
<div
class
=
"input-group-text"
>
</div>
</div>
</div>
</div>
</div>
script type=
'text/javascript'
>
$(function () {
//When the blur event occurs from your Textbox (you lose focus)
$(
'#inputEmail'
).blur(function () {
var email = document.getElementById(
"inputEmail"
).value;
var expr = /^([\w-\.]+)@@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
if
(!expr.test(email)) {
document.getElementById(
"labelMessage"
).style.display =
"inline"
;
}
else
{
document.getElementById(
"labelMessage"
).style.display =
"none"
;
}
});
});
/script>
Reply
Answers (
4
)
How to call more than two models within your View?
DataReader associated with this Command which must be closed