Skip to content
Advertisement

Check if innerHTML is empty

I have a ajax call on my onkeyup event, that checks if the given email address is in the database or not. My problem is, that I can’t find a right solution to check if the ajax response is EMPTY and if yes I need to disable a button.

This is the ajax.php output:

JavaScript

This is the JavaScript for the ajax call AND the button disable and enable function (ajax call only if the email address is valid):

JavaScript

As you can see I tried with whitespace elimination, but no luck… after empty response the button is still not disabled…

Can someone help me out here?

Advertisement

Answer

Use this function..

JavaScript

Hope this helps..

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement