Here I have an example of how to create a 'side_bar' with javascript when I click on marker
var side_bar_html = "<a href='javascript:google.maps.event.trigger(gmarkers["+parseInt(gmarkers.length-1)+"],\"click\");'>"+place.name+"</a><br>"+ $('<div>').raty({ score: place.rating, path: 'http://wbotelhos.com/raty/lib/img' }) +"</br>";
document.getElementById('side_bar').innerHTML += side_bar_html;
}
''raty is jquery plugin for visualise rating with stars''
but this code give me this results:
Name of place
[object Object]
... ...
How I can put this code in function to work it correctly?
Is any way to do this?
You are concatenating a jQuery wrapper to a string, that is the reason
without changing much from your code
var side_bar_html = "<a href='javascript:google.maps.event.trigger(gmarkers[" + parseInt(gmarkers.length - 1) + "],\"click\");'>" + place.name + "</a><br>" + '<div class="raty" />' + "</br>";
$(side_bar_html).appendTo('#side_bar').filter('.raty').raty({
score : place.rating,
path : 'http://wbotelhos.com/raty/lib/img'
})