If I have 2 textboxes, without using id's, how do I determine which textbox is firing off "keyup" events?
For various reasons I need to use classes instead of id's, where the class name is the same for both textboxes.
Infact, I could have the same textbox on the screen many times with the same class name.
The HTML looks something like this
<div class="outer_div">
<input type="text" class="mytextbox" />
<div class="inner_div"></div>
</div>
<div class="outer_div">
<input type="text" class="mytextbox" />
<div class="inner_div"></div>
</div>
<div class="outer_div">
<input type="text" class="mytextbox" />
<div class="inner_div"></div>
</div>
use
$(".<classname>").keyUp(function (){
$(this).<whatever u do here>
});
You can use the data- attribute to assign an id eg..
Then do something like.
Since you don't have any id then you can use this keyword in the keyup function
You could attach pretend IDs onto the elements using
data()
Then read it back in the
keyup
eventyou may try this...:)