JSFiddle - React, Tailwind, and code Playground
HTML
<input type="checkbox">
<object class="iframe" type="text/html" id="download">what</object>
CSS
object {
font-family: sans-serif;
font-weight: bold;
text-decoration: none;
}
object:after {
content: attr(data);
}
JavaScript
// Get DOM objects ready
var checkbox = document.querySelector('input[type="checkbox"]'),
iframeload = document.querySelector('#download');
// Set up function to change URL
function chooseUrl() {
var url =
checkbox.checked ? 'http://knlofficial.com/bite/' : 'http://knlofficial.com';
iframeload.setAttribute('data', url);
}
// Change URL on checkbox value change
checkbox.addEventListener('change', chooseUrl);
// Run chooseUrl once to set initial value
chooseUrl();