I have this javascript (jquery), in which I've defined a variable. This variable contains a string which might have one or more ul's in it. I want the script to select every ul and run a function for each of them.
But unfortunately, nothing happens when loading the page.
<script type="text/javascript">
var wid_tekst1 = "<?php echo $wid_tekst1; ?>";
$(wid_tekst1).find('ul').each(function() {
alert('hoi');
})
</script>
The $wid_tekst1 contains:
<p>test tekst 1</p>
<ul>
<li>testitem</li>
<li>testitem</li>
<li>testitem</li>
<li>testitem</li>
<li>testitem</li>
<li>testitem</li>
<li>testitem</li>
</ul>
<p>test</p>
Thank you