Half Blood Prince Half Blood Prince - 1 year ago 172
Javascript Question

jQuery - not working with input type search

I have a field with input type


When I try to select that with jQuery I get
VM535 jquery-git.js:1529 Uncaught Error: Syntax error, unrecognized expression: unsupported pseudo: search

Check the fiddle - Fiddle

How do I select that field?
(note: I do not have any unique class or id applied to that field, actually it's plugin generated.)

Actually I am using
jQuery DataTable
plugin and I want to add a Go button just besides the search box. For this I am trying this workaround - to select the
search box with jQuery and add button besides it with
method. Please suggest me if there is any other way for this.

Answer Source

input:search is not a valid selector(not listed in Selectors section in the docs)

Use Attribute Equals Selector input[type="search"]

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<input type="text" value="text">
<input type="search" value="search">

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download