Question

I know that you can disable an input field like this:

<input disabled></input>

But is there a simple way to disable all the inputs within an iFrame a similar way? Like this:

<iframe src="/foo" disabled></iframe>
Was it helpful?

Solution

Unfortunately no answers have been satisfactory (or they just didn't answer the correct question), so I am answering my own.

The answer I've found from the documentation on the properties/attributes has led me to believe it is impossible. Since I was using an iframe from a source I could modify, I fixed what I needed to there, but it would have been a much cleaner and DRYer solution if this were possible.

OTHER TIPS

I don't think you can affect and iframe from an outside source

I think its not possible to disable an iframe but you can use a div over the iframe to avoid user interaction

<div id="blank" style="display:none; position:absolute; top:100px; left:100px; width:600px; height:400px;">

changing top left width and height with the coordinates and size of your iframe

and when you want to disable iframe

document.getElementById("blank").style.display="block";

if you want to disable iframe since load just change display none to block on the original div

I hope this helps :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top