views:

56

answers:

2

For example:

<input type="text" size="5" id="question'+$qid+'"onKeyUp="checkanswer('+i+')"/></div>

I want to refer to the "question'+$qid+'" element inside the function checkanswer(), how to do it?

Maybe I can do it by onKeyUp="checkanswer('+$qid+')", is there other elegant way to do it?

+1  A: 

Not sure I fully understand what you're asking for, but if you're trying to pass the current item to checkanswer() you can just do:

<input type="text" size="5" id="question'+$qid+'"onKeyUp="checkanswer(this)"/>
Jared
A: 

Assuming $qid and 'i' are the same number you could do $('#question' + param) in your checkanswer() function (where 'param' is the parameter that 'i' represents).

Darrell Brogdon