July 7, 201214 yr On the website that I'm making, I have quite a lot of inputs that I ofcourse want to check when people are typing something in. But making a function for every single page is kind of annoying and I thought that there might be a better solution to this. For example when registering an account it would check the 2 input types password and see if they're equal to eachother, if not it will change the class of the inputbox so it gets a red outline. And also for other stuff like email adresses. So is it possible to do something like this in Javascript?
July 7, 201214 yr On the website that I'm making, I have quite a lot of inputs that I ofcourse want to check when people are typing something in. But making a function for every single page is kind of annoying and I thought that there might be a better solution to this. For example when registering an account it would check the 2 input types password and see if they're equal to eachother, if not it will change the class of the inputbox so it gets a red outline. And also for other stuff like email adresses. So is it possible to do something like this in Javascript? I'd suggest using a framework which will make it much easier for you to validate inputs. Alternatively, make your own validation class(es) in PHP. Not recommended to use Javascript for any serious validation - people can turn JS off, and you'll have a serious problem.
July 8, 201214 yr Author I'd suggest using a framework which will make it much easier for you to validate inputs. Alternatively, make your own validation class(es) in PHP. Not recommended to use Javascript for any serious validation - people can turn JS off, and you'll have a serious problem. I already have that but I want to make it visible to the user when they're typing it in too, I just think it's a nice addition to the website and it'll make it easier for the user.
July 8, 201214 yr How about a jquery plugin? This will help when things are "requred" or making sure email addresses are correct or when needing to compare two fields. Goodluck, ~evu.
Create an account or sign in to comment