Uncaught ReferenceError: PAGEHTML is not defined
My Object is defined in my JS why does this return an error? I have other onclicks that I've passed the object name through.
HTML
<button id="addLocation" onclick="insertBefore(PAGEHTML.uarAddLocation, addLocation)">+ Add Location</button>
JS OBJECT
var PAGEHTML = {
uarAddLocation: `<label for="amountUnusual">Amount of Unusual Activity</label>
<input id="amountUnusual" class="number" />
<div class="fourtyFiveWidth inlineBlock">
<label for="fromDate">Unusual Activity Start Date</label>
<input id="fromDate" class="datepicker number" />
</div>
<div style="margin-left: calc(10% - 4px)" class="fourtyFiveWidth inlineBlock">
<label for="toDate">Unusual Activity End Date</label>
<input id="toDate" class="datepicker number" />
</div>
<label for="AULocation">Unusual Activity Location</label>
<input id="AULocation" />`;
};
JS FUNC
function insertBefore(selector, html){
console.log("selector: "+selector);
$(html).insertBefore("#"+selector);
};
PAGEHTML.uarLocationto your function but your object is calledPAGEHTML.uarAddLocation