I have an iframe element in my html page. src
attribute of the iframe varies dynamically based on user selected values [SHAP,LIME]
. User values are shown as drop down with id explanationType
.
However I need to add an additional iframe into the html page if user selects SHAP
but not when user selects LIME
. How to achieve this?
HTML
<iframe id="js-iframe" src="https://www.youtube.com/watch?v=hVCYwwFwGEE&list=RDhVCYwwFwGEE&index=1" width="100%" height="80%" frameborder="0">
<p>Your browser does not support iframes.</p>
</iframe>
JS
// Update iframe
var explanationTypeOptions = document.getElementById("explanationType");
var explanationURL = explanationTypeOptions.options[explanationTypeOptions.selectedIndex].getAttribute('kibanaurl');
if(explanationURL) {
var iframeDOMHandler = document.getElementById("js-iframe");
iframeDOMHandler.setAttribute('src', explanationURL);
}