Jack Pilowsky
Jack Pilowsky

Reputation: 2303

jQuery not recognizing tel input type

I'm using jQuery 1.9.1.

I'm using one of the new input types for telephone number "tel"

<input class="phoneUS" id="cphone" name="phone" type="tel" required/>

But when I try to select them with jQuery:

$('input["tel"]').css('background','red');

It doesn't work. So, I try it on the console and I get:

Error: Syntax error, unrecognized expression: input["tel"]

Upvotes: 0

Views: 6021

Answers (1)

Andy Holmes
Andy Holmes

Reputation: 8077

$('input[type="tel"]').css('background','red');

Should be what you're after :) You were very close, you just need to tell jQuery that it is an input type you are looking for.

Upvotes: 8

Related Questions