I m trying to get a alert if clicked on th button where the first value in the list is displayed. I m using the following code based on this threat. In this threat they are using a table not a list. But i thought that that was not a problem... i think it is now. The code i m using is this.( The features are from a openlayer map):
<ul id ="table_overvieuw">
<#list features as feature>
<li><b>Type: ${type.name}</b> (id: <em>${feature.fid}</em>):
<ul>
<#list feature.attributes as attribute>
<#if !attribute.isGeometry>
<li><b>${attribute.name}</b></li>
${attribute.value}
</#if>
</#list>
<br><br>
<input type="button" name="geef slijpplaten info" class="ok" value="OK" onclick="myFunction()" />
</ul>
</li>
</#list>
</ul>
<script type="text/javascript">
function highlight(e) {
if (selected[0]) selected[0].className = '';
e.target.parentNode.className = 'selected';
}
var table = document.getElementById('table_overvieuw'),
selected = table.getElementsByClassName('selected');
table.onclick = highlight;
function myFunction(){
alert($("li.selected li:first" ).html());
}
</script>
The error i m getting in the console is : Uncaught ReferenceError: $ is not defined. The $ is from this piece of code:
alert($("li.selected li:first" ).html());
can somebody give me a helping hand?