generate hyperlink

by kkdaily

HTML

<div id="hyperlink"></div>

JavaScript

//random 5-digit number to add to end of url
var _id = Math.floor(Math.random() * 90000) + 10000;
  
//actual url for user to click on
var url = "www.blahblah.com/#/app/tabs/tours/" + _id;

//where the hyperlink will be displayed in html
var div = document.getElementById("hyperlink");

//create hyperlink in html
var link = document.createElement('a');
link.appendChild(document.createTextNode("Go to Tour info"));
link.setAttribute("href", url);

//place hyperlink inside of div
div.appendChild(link);