Drakken Saer
Drakken Saer

Reputation: 889

jQuery - Check if input field is untouched

I'm trying to do something with jQuery or just JavaScript (either way works). I need to check if a certain form input field is untouched AND has a value.

Essentially what's going on is that, from a previous page, a user fills out a small form... they are redirected to the full version of the form with said information pre-filled. To reduce hassle, I would like to make it so that as the user fills out the form, it skips the pre-filled input fields. I need to do this in a non-blocking away, so if a user actually clicks on a pre-filled input field to change the value, it won't just skip again.

Is this even possible?

Edit: In this context, when I say "skip", I mean as in to move onto the next form field in the form, if there is any left.

Upvotes: 0

Views: 2206

Answers (1)

Sarah Groß
Sarah Groß

Reputation: 10879

I don't know what you mean by "skip". But you can add an event listener for the change event of the inputs and then set a class/data-attribute or store the information as a js property, so you can test for this value and treat inputs differently if they have been touched.

Upvotes: 1

Related Questions