Managing optional lines of HTML
Now that I have a global variable that tracks clicking an anchor (see
https://forum.jquery.com/topic/global-click-variables), I have a set of HTML lines that need to be included or removed depending upon the state of the flip/flop. In one case
.html("") and in the other
.html("some html text").
The html text is created by successive concatenations to a string but this gets rather messy.
Is there a way to include or skip normal looking lines of html leaving them easier to edit?
Here's what I have today:
var GPSloc = false;
$("#FlipLoc").click(function(e) {
e.preventDefault();
if (GPSloc==true) {
GPSloc = false;
$("#GPSinner").html('');
} else {
GPSloc = true;
GPStxt = '<br><b>Search Center -- Latitude: <input type="text" name="SearchLat" id="SearchLat" size="5">'
GPStxt = GPStxt + ' Longitude: <input type="text" name="SearchLong" id="SearchLong" size="8">'
GPStxt = GPStxt + ' (decimal number)'
GPStxt = GPStxt + '<br>Search Radius: '
GPStxt = GPStxt + '<input type="text" name="SearchRadius" id="SearchRadium" size="8"> Miles</b><br>'
$("#GPSinner").html(GPStxt);
}
});