Is it possible to add text boxes into an iframe of the same domain. So i have created a button for the user to click.
<button id="text" onclick="addTextBox()">Text</button>
As the user clicks on the button, I need a text box added within the iframe.
<iframe id="iframeDiv" class="section"></iframe>
I have tried this
JS:
function addTextBox() {
var text = '<div><textarea name="textbox" id="textbox" cols="10" rows="1"></textarea></div>';
var iframe = document.getElementById('iframeDiv'),
iframe.innerHTML += parent.text;
$('div').draggable({
cancel: "textbox",
start: function () {
$('#textbox').focus();
},
stop: function () {
$('#textbox').focus();
}
});
}
window.onload = function () {
addTextBox();
return;
}
I have done a fiddle too: JSFiddle
I also want to understand how the text tag can be appended to the DOM structure
document.createElement(nodename)