I am trying to get jQuery to change the html of an element and include PHP. It all works fine apart from PHP. Here is what I have:
$('.gridheader').each(function(index){
$(this).toggle(function (){
$('.gridimage:eq('+index+'), .gridinfo:eq('+index+')').slideToggle();
$('.gridheadinfo:eq('+index+')').html('Click to close <img src="<?php echo base_url() ?>/assets/images/closetab.png" width="10" height="10" />');
}, function(){
$('.gridimage:eq('+index+'), .gridinfo:eq('+index+')').slideToggle();
$('.gridheadinfo:eq('+index+')').html('Click for info <img src="<?php echo base_url() ?>/assets/images/scrollup.png" width="11" height="10" />');
});
});
I have the image originally in there (HTML):
<div class="float-left">Kredible</div><div class="float-right gridheadinfo">Click for info <img src="<?php echo base_url() ?>assets/images/scrollup.png" width="11" height="10" /></div></div>
The HTML works fine, however when I change it using jQuery the image doesn't show. Ive looked at it in the inspector after the change and the PHP shows up as PHP instead of converting to HTML?
Im rather puzzled.
Thanks.