I can't use JQuery.
Trying to set an event listner on td element, such that if user clicks on it, it will read text in td and will look for duplicates in same table rows. E.g ABC is duplicate.
<tr><td onclick='foo()'>ABC</td><td>7</td></tr>
<tr><td onclick='foo()'>DEF</td><td>8</td></tr>
<tr><td onclick='foo()'>HIJ</td><td>9</td></tr>
<tr><td onclick='foo()'>ABC</td><td>10</td></tr>
Some one said I can't use onclick method on td tag, so I did this.
<tr><td><span onclick='foo()'>XYZ</span></td><td>2</td></tr>
And event function is as follows:
function foo(e) {
alert('hi');
alert(e.target);
// alert(window.Event.target.innerHTML);
// alert(event.target.text);
// alert(event.target.tagName);
// alert(event.target.textContent);
// alert(event.target.parentElement.tagName);
// alert(event.target.innerHTML);
The first thing I noticed is that Firefox, IE, don't even start event code methods and properties. They just run till hi alert. But the rest of code doesn't get executed.
Chrome, on the other hand, is able to run the event code. I can successfully get innerHtml using alert(event.target.innerHTML);
How to make it run in Firefox and IE browsers.