Reputation: 9747
Hello I have a simple HTML table with several rows. I want to alert the user with a message when they click on a particular row. Here is what I tried to get this to work...
<tr onClick="alert(some Message)">
<td>${o.hospitalId}</td>
<td>${o.name}</td>
<td>${o.address}</td>
</tr>
However, that is not working. Am I missing some HTML basics here?
Upvotes: 0
Views: 5889
Reputation: 1431
Some Message should be single quotes ' text ' reason behind your alert not working
<table>
<tr>
<td onclick="alert('You are clicking on the cell EXAMPLE')"> Data </td>
</tr>
</table>
Upvotes: 0
Reputation: 1
add these 'some message' and then it will work fine
<tr onClick="alert('some Message')">
<td>${o.hospitalId}</td>
<td>${o.name}</td>
<td>${o.address}</td>
</tr>
Upvotes: 0
Reputation: 66
Code seems to be good, of course if you want display literary 'some Message' text it must be between ' and ', like in lante's example. If it won't work still, you can have javascript disabled in browser settings.
Upvotes: 1