I’m using a CMS to allow users to add keywords to their profiles, but I’m wanting to limit that to 10 keywords, which are comma-delimited, by counting the number of commas (in this case, 9).
Any ideas on how to go about doing this with jQuery? I’ll be doing a double-check on the server-side, but I’d like a quick little, live error checker on the front-end.
instead of counting commas, how about splitting them then get the length.
fiddle to see.
and if you’re using this in a
<form>, you could edit the submit handler like this,another fiddle
Welcome to stackoverflow.com
Don’t forget to accept an answer