input:email in js

I have a contact form that uses recaptcha v2. I have use the default “requirement” verification by adding required in the form input tag:

<label for="formAuthor">
    Name<span style="color: #ff0000;">*</span>
<input type="text" name="formAuthor" id="formAuthor" value="<?php if(isset($_POST['formAuthor']))  echo $_POST['formAuthor'];?>" size="40" required>

I uses a .js to fade the label away when the field is on focus.
But if I set the input type to "email" (to get the correct verification from Recaptcha) the fade away effect doesn’t work anymore.

Here is how the revelent part of the .js

$jformItems = $j("input:text, textarea");

I’ve tried to add input: email but with success.

$jformItems = $j("input:text, input:email, textarea");

Any idea how I can get this .js to work with the input:email ?

Answer: based on sacreyoule answer this is what solved it!

$jformItems = $j("input:text, input[type=email], textarea"); 

Source: forms

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.