Q:

Javascript function won't pass parameter

I have the following code:
function createMarker(latlng, name, address) {
  var html = "<b>" + name + "</b> <br/>" + address + "<br/> <a onclick='moreInfo(name)'>Learn More</a>";
  var marker = new google.maps.Marker({
    map: map,
    position: latlng
  });
  google.maps.event.addListener(marker, 'click', function() {
    infoWindow.setContent(html);
    infoWindow.open(map, marker);
  });
  markers.push(marker);
}

function moreInfo(name){

    $('#dcFinder').hide();
    $('#moreInfo').show();
    $('#name').html(name);

}

Which refers to the google map store locator I'm working on. I'm trying to make a link to the moreInfo function, passing through the name used in the first function.
When the link is clicked, the appropriate divs are shown and hidden, but the name is not showing.

A:

You need to pass through the variable in your html so try this:
 var html = "<b>" + name + "</b> <br/>" + address + "<br/> <a onclick=\"moreInfo('" + name + "')\">Learn More</a>";

