I have a quick question about keyup with jquery. I have several form input fields on one page, they all have different id’s but are all either one of two classes – numberbox or textbox and are all contained in a div id – content. Can I use these classes or the div to catch keypresses as I won’t know the id of the form? Or even just catch the keypresses for all forms on the page. I don’t know how well I explained that:
This will work with a form id= “add”
$(add).keyup(function () {
value = $(add).val()
alphaCheck()
;
}).keyup();
But if I don’t know the form id only it’s class or the div it is contained it can I use that? So something like:
$(.class).keyup(function () {
or
$(#div).keyup(function () {
I may have explained that really badly, but hopefully someone can point me in the right direction. It would be greatly appreciated, thanks.
Sounds like this is what you want: