troubleshooting Question

javascript check input pattern and add class if correct pattern

Avatar of movieprodw
movieprodw asked on
JavaScriptCSS
2 Comments1 Solution281 ViewsLast Modified:
Hello,

I would like to use javascript/jquery to see if the input of a text field fits the serial number pattern, if so I want it to add the class 'snmatch' if not I want it to have the css class 'nosnmatch'

<style>
	.nosnmatch { border: solid 1px blue; }
	.snmatch { border: solid 1px green;	}
</style>
<form method="post" id="sncheck">
	<input type="text" class="nosnmatch" name="snumber" placeholder="Please enter your serial number PPR0000000" />
</form>
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros