Alex Rivera | Logout

How to prevent user from typing in text field without disabling the field?

Asked 2011-08-05T05:03:30.170
112

I tried:

$('input').keyup(function() {

   $(this).attr('val', '');

});

but it removes the entered text slightly after a letter is entered. Is there anyway to prevent the user from entering text completely without resorting to disabling the text field?

Edit
Report

1 Answer

3

One other method that could be used depending on the need $('input').onfocus(function(){this.blur()}); I think this is how you would write it. I am not proficient in jquery.

answered 2011-08-05T05:17:01.410

Your Answer