How to make <td> clickable
<p>I have created a table to display my SPARQL query result in the <code>&lt;td&gt;</code>, the result does display however I want it that when the<code>&lt;td&gt;</code> (result) is clicked on it displays a message box. Right now an extra <code>&lt;td&gt;</code> is displayed at the top and it only works for that particular one. Nothing seems to happen when clicking on the actual result <code>&lt;td&gt;</code>:</p>

<p>My code: </p>

<pre><code>    &lt;table id="results"&gt;
    &lt;td class="td" onclick="myFunction()"&gt;&lt;/td&gt;
    &lt;/table&gt;
    &lt;body&gt;
        &lt;script type="text/javascript"&gt;
         PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;        
PREFIX type: &lt;http://dbpedia.org/class/yago/&gt;
PREFIX prop: &lt;http://dbpedia.org/property/&gt;
SELECT ?country_name
WHERE {
    ?country rdf:type type:Country108544813.
    ?country rdfs:label ?country_name.

}
                "Limit 1"
                ].join(" ");

                alert("this query: [" + query + "]");

                var queryUrl = url + "?query=" + encodeURIComponent(query) + "&amp;format=json";




&lt;/body&gt;
</code></pre>

<p>The JavaScript code I got it from an online material so still getting my head around it , the main use of it is to display the query result. So yeah answers are really appreciated and thanks for reading:)</p>