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
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
JQuery Check Textbox Value is Empty or Null
Mukesh Kumar
Oct 03
2015
Code
93.3
k
0
1
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
<html xmlns=
"http://www.w3.org/1999/xhtml"
>
<head>
<title>jQuery Check
if
string
empty or
null
</title>
<script type=
"text/javascript"
src=
"http://code.jquery.com/jquery-1.8.2.js"
></script>
<script type=
"text/javascript"
>
$(function() {
$(
'#btnCheck'
).click(function() {
var txt = $(
'#txtName'
);
if
(txt.val() !=
null
&& txt.val() !=
''
) {
alert(
'you entered text '
+ txt.val())
}
else
{
alert(
'Please enter text'
)
}
})
});
</script>
</head>
<body>
<div>
Enter Text:
<input type=
"text"
id=
"txtName"
/>
<input type=
"button"
id=
"btnCheck"
value=
"Check"
/>
</div>
</body>
</html>
jquery
Textbox
Check Textbox Value using JQuery