Is there a another way to pass values to answerTapped() from the html
code other than using document.getElementById('id').value as the
argument ?
Thanks,
Amrita
$('#answer-1').text() will give you the text inside the opening and
closing tags of #answer-1. For example, if your code looks like this:
<div id="answer-1">33</div>
then $('#answer-1').text() will return "33". This will give you the
answer directly, and that may be all you need to do.
Another option would be to pass in "1" as the argument to answerTapped
for #answer-1, "2" for #answer-2, etc. (For the former, your code
would look like onclick="answerTapped(1);"). In that case, you would
still need to call .text() from within your answerTapped() function to
retrieve the actual answer value.
Hope that helps,
Steve
On Feb 6, 12:04 am, Amrita Thakur (अम्रिता ठाकुर)