Reputation: 1709
This is absurd, I feel like in kindergarten. I've already tried any combination that I could think of, and I just gave up trying.
<script type="text/javascript">
function myFunction(){
alert("test");
}
</script>
<a href="#" class="love" id="<?php echo $img_id; ?>" onclick="myFunction()">
This is a php file that is being "inserted" in a parent html, but I don't see why this would mess with javascript.
Upvotes: 0
Views: 273
Reputation: 382881
Close out your <a>
tag:
<a href="#" class="love" id="<?php echo $img_id; ?>" onclick="myFunction()">TEST</a>
And your code works:
Upvotes: 1