Ok so I have divs on my webpage that when clicked are assigned a variable. I need to access these variables later on when another button is clicked to include them in the email I send. My var mailbody works as it is a local variable I think. But if I replace it with frameColour then it won't work as it isn't global. How can I get around this?
$('#purple').click (function() {
$(".border").css("fill", "#763d81");
var frameColour = "purple";
});
$("#button").click (function() {
var mailbody = "hello world.";
window.open('mailto:[email protected]?subject=My Frame&body=' + mailbody);
});
document.ready(they should be) -$(function(){ /* here */ });- that is not global scope, just a scope that is a little broader.