I have a JS variable, that defines a DOM element that I want to show somewhere else on the DOM, defined as
var salesRep = $("ul.map").attr("id","1");
And I want to pass it to a function called show();
So I made
function getSalesRep(salesRep){
return salesRep
}
Then inside the show() function I called getSalesRep()
Which looks like
function show(){
getSalesRep();
var x1 = "<p>" + salesRep + "<p>";
$("#map").after($(x1));
}
However on the DOM, where the salesRep variable that contains HTML should appear, it outputs [Object object]
I can seem to figure it out...I am convinced it has something to do with the way I am defining the object wrong.
salesReplook in the DOMgetSalesRep();going to return anything other thanundefined? It returns the input passed to it, and you haven't passed any. Doh!