Click here to Skip to main content
15,066,168 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I have a form with a textbox with id "link" and I want to set the parent's textbox value with the resp label's text inside iupload iframe.

The label resp gets success text when file uploaded to google drive.

HTML
<form>
<label>Link</label>
<input type="url" id="link" name="link" placeholder="drive.google.com/????" required class="form-control">
</form>

<iframe id="iupload" src="https://script.google.com/macros/s/AKfycbwzN_1XdItgP8HVTdRHg_Ex9UYdgW4d039V1ZCox2wcdygDEVQ/exec" style="border:none;" title="Upload Course Work"></iframe>


Please help.

What I have tried:

JavaScript
$(document).read(function(){
	var resp = $('iframe[name=iupload]').contents().find('#resp');
	$("resp").change(function(){
		var resptxt = $(this).text();
		$("#link").val(resptxt);
	});
});
Posted
Updated 2-Sep-20 7:28am
v2
Comments
F-ES Sitecore 2-Sep-20 14:31pm
   
It's ".ready" not ".read". Regardless I don't think you'll be able to do this as security stops you amending frames from other "origins" or domains. As the iframe contains a document served from google.com your code (that isn't served from google.com) won't be able to amend it.
nyt1972 3-Sep-20 2:54am
   
Ok, thanks my mistake, I changed it to ready, but still not working

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900