1. Add Jquery on page.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
2. Add HTML textarea.
<textarea id="txtcomment" placeholder="Type your comment here and press Enter Key...."></textarea>
3. add script after text area.
<script type="text/javascript">
$('#txtcomment').keypress(function (event) {
var keycode = (event.keyCode ? event.keyCode : event.which);
if (keycode == '13') {
alert($('#txtcomment').val());
savecomment($('#hdnBlogid').val(), $('#txtcomment').val());
}
event.stopPropagation();
});
</script>
4. run the html page and type in textbox when you press enter that time you can see one alert box with textbox value.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
2. Add HTML textarea.
<textarea id="txtcomment" placeholder="Type your comment here and press Enter Key...."></textarea>
3. add script after text area.
<script type="text/javascript">
$('#txtcomment').keypress(function (event) {
var keycode = (event.keyCode ? event.keyCode : event.which);
if (keycode == '13') {
alert($('#txtcomment').val());
savecomment($('#hdnBlogid').val(), $('#txtcomment').val());
}
event.stopPropagation();
});
</script>
4. run the html page and type in textbox when you press enter that time you can see one alert box with textbox value.
Comments
Post a Comment