I am trying to load content from the database using simpletip. My code:
<script type="text/javascript">
$(document).ready(function(){
$('a.regularsList').simpletip({
onBeforeShow: function(){
this.load('/regulars/tooltip', {id: $(this).attr("id")});
}
});
})
I get that id is undefined. I don’t understand what am i doing wrong since i am trying to access the value of the id attribute.
In your current code
thisrefers todocument, instead use.each()loop here so thatthisrefers to the anchor you want, like this:Inside the
.each()loop,thisrefers to the currenta.regularsListelement you’re looking over, so you can just usethis.idto get theidproperty.