How to append an submit button after of typing valid e-mail at input field - jQuery?

StackOverflow https://stackoverflow.com/questions/8844575

سؤال

I'm figuring out how to add submit button when e-mail is valid from field, there a jsfiddle you can understand it:

http://jsfiddle.net/5bQQW/

It didn't work because it doesn't appear a submit button after of valid e-mail

Can anyone help me it?

thx!

هل كانت مفيدة؟

المحلول

Your if and else conditions are the same, therefore the else won't get executed until you remove the not (!). But then there's the problem if the address matches your pattern but the user continues to type a valid email. Then multiple submit buttons are appended. You'd be best off just showing and hiding the button rather than constantly appending an element.

Try working off of a revision of your jsFiddle.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top