I am not able to trigger click event on the second td. When I try console
console.log($("#jq_quiz_task_container table tbody tr td:nth-child(2)").html());
The below result appears....
<a style="cursor:pointer" onclick="javascript:jq_QuizNextOn(); void(0);" title="Next" onmouseover="jlms_WStatus('Next');return true;" onmouseout="jlms_WStatus('');return true;" class="btn btn-primary"> Next </a>
How do i trigger the click event for this 'a' inside second TD ?
I have tried the below code in the console
$("#jq_quiz_task_container table tbody tr td:nth-child(2) a").click();
But it displays the object in the console
[a.btn.btn-primary]
Please find the code as given below.
<div id="jq_quiz_task_container" class="pull-right" style="float: right;">
<table class="jlms_toolbar_buttons" align="right" style="text-align: right; width:auto; " cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr>
<td valign="middle" style="vertical-align:middle">
<a style="cursor:pointer" onclick="javascript:jq_QuizPrev(); void(0);" title="Prev" onmouseover="jlms_WStatus('Prev');return true;" onmouseout="jlms_WStatus('');return true;" class="btn btn-primary"> Prev </a>
</td>
<td valign="middle" style="vertical-align:middle">
<a style="cursor:pointer" onclick="javascript:jq_QuizNextOn(); void(0);" title="Next" onmouseover="jlms_WStatus('Next');return true;" onmouseout="jlms_WStatus('');return true;" class="btn btn-primary"> Next
</a>
</td>
</tr>
</tbody>
</table>
</div>
since we do not know what is the definition for jq_QuizNextOn(), it is hard to say what is going on.
If I define it as:
var jq_QuizNextOn = function(){
console.log('test');
}
and then execute in console
$("#jq_quiz_task_container table tbody tr td:nth-child(2) a").click()
it will log "test" for me. tested in chrome.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.