How can I select all inputs with number type in jQuery?
The following code doesn't work:
$(':input[type="number"]').click(function () {
alert('hello');
});
Thanks.
Your selector is correct. Using the attribute-equals-selector
(docs), it will select input elements with that type.
You'll need to be sure the DOM is loaded before running it.
Example: http://jsfiddle.net/H2aQr/
$(function() {
$(':input[type="number"]').click(function () { alert('hello'); });
});