Link to home
Start Free TrialLog in
Avatar of maqskywalker
maqskywalker

asked on

using jquery or JavaScript to prevent user from typing a character string in a textbox

I'm using jquery and html.

Example Fiddle
https://jsfiddle.net/0as78yb1/

I'm using jquery to prevent a user from typing the less than symbol which is < and the greater than symbol >


How do i revise my fiddle to..

allow the less symbol < 
allow the greater than symbol >
allow this character /

The only thing I want to restrict is, don't allow a user to type the greater than > if it was preceded with this symbol /

So if a user typed these symbols right next to each other /> don't allow the greater than symbol at that point.

So if a user types / >  , that would be ok because there is a space in between then

Basically i'm trying to not allow a user to type a closing html tag.

How do I revise my fiddle to do that?
SOLUTION
Avatar of Chinmay Patel
Chinmay Patel
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of maqskywalker
maqskywalker

ASKER

Thanks