dafyddgj dafyddgj - 1 year ago 78
Javascript Question

How to put max length on a field using JavaScript?

I've got a working function for empty fields already. Do I need another function to set a max length on these fields or can I edit my current function?
If so how would I fit the max length code in?

Answer Source

Don't use JavaScript to do HTML's job.

<input type="text" name="fname" required maxlength="10" />
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download