Friday, March 29, 2013

Check Empty Value or Null Value using JQuery in ASP .NET

==>>  Create a website in add new page  and paste the Code:--

1.  ASPX PAGE CODE:-


 <html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Empty Value or Null Value using JQuery in ASP .NET</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script type="text/javascript">
$(function () {
$('#btnClick').click(function () {
var str = $('#txtfield');
if (str.val() != null && str.val() != '') {
alert('you entered String ' + str.val())
}
else {
alert('Please enter text')
}
})
});
</script>
</head>
<body>
<div>
Enter Text: <input type="text" id="txtfield" />
<input type="button" id="btnClick" value="Click" />
</div>
</body>
</html> 

No comments:

Post a Comment