Recently, I found a simple jQuery event that loads a page into an iframe within the corresponding div when clicked.
You can check out the JS Fiddle example here
Now, my goal is to achieve the following:
Instead of using separate codes for #frame1 and #frame2, I want to load events using the same code.
showIframe = function (url) { document.getElementById('iframetarget').src = url; document.getElementById('frame').style.display = 'block'; }
When clicking on 1 in the list style, the corresponding iframe page should load. Similarly, clicking on 2 should load the respective iframe page while hiding or "killing" the page loaded for 1
You can view the desired fiddle demo here
I've tried using the document.getElementByClassName
syntax since using the same ID in different divs is not possible, but it doesn't seem to work. Any help would be greatly appreciated.