• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 437
  • Last Modified:

Disable carriage returns ASP NET Browser

Is there a way to disable carriage returns using javascript (or any other way) so that when the user clicks "return" on his keyboard the web browser doesn't do anything (like reload, etc.)?

Thanks in advance!
0
jeremyduj
Asked:
jeremyduj
  • 2
1 Solution
 
CCongdonCommented:
Generally, there is no way to disable parts of the keyboard (hardware) from within a browser.
However, one trick is that you could put a text area on the screen, and then use CSS to creatively hide it...and then once the pages loads, set the focus to the text area...
Or possibly someone has a MUCH better idea.
0
 
jeremydujAuthor Commented:
well even if using javascript if there is a way to "do nothing" when a carriage return is entered, that would be just as good.
0
 
Saqib KhanSenior DeveloperCommented:
yes you can Stop return key.
<script>

 function kk(e) {

   key = e ? e.which : window.event.keyCode;
   if(key==13) {
      return false;
    }

 }


document.onkeypress = kk

</script>
<textarea name="t1" rows=10  cols=10>hh</textarea>
0
 
jeremydujAuthor Commented:
Thanks so much. Works flawlessly.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now