Arrays in jQuery
How开发者_Python百科 can I use arrays in jQuery?
I only want to use numbers 1,2,3,4,5 in a textbox, but how can I set the array and retrieve it?
e.g. if I'm using d.charAt(1) == "1"
it is only 1 number, I want to be able to check for 1 or 2 or 3 or 4 or 5 to use the same index. I know I can use ||
, but what if I were trying to check for 100 numbers?
Can anyone help me?
To restrict input in a textbox to numbers only I've used jquery.numeric plugin.
$(document).ready(function(){
$(".numeric").numeric();
});
You can use this with textareas also!
use $.inArray()
精彩评论