• 0

Change textbox in iframe from parent


Question

Hey,

Im having a bit of a problem, im trying to update the value in a texbox that is in an iframe. the updated value is coming from the normal page.

<input type="text" name="tb1">
<input type="button">

<iframe>
<input type="text" name="tb2">
</iframe>

I want to take the value in tb1 and put it in tb2 when the user presses the button.

Im still searching the net to see if i can see how to do this, but im hoping that some smart person here will already know :D

Any ideas?

Thanks in advance

Link to comment
https://www.neowin.net/forum/topic/875894-change-textbox-in-iframe-from-parent/
Share on other sites

3 answers to this question

Recommended Posts

  • 0

This can be done using javascript. I would recommend doing this when the form is submitted rather than user click on button. You could also do this when the input looses focus. If you have included jquery framework it can be done with the following code

$('input[name="tb1"]').blur(function(){

val = $(this).attr('value');

$('input[name="tb2"]').attr('value', val);

});

  • 0

Assuming you can give your input elements IDs (they were only named in your example) and that you only have one iframe, this should work.

window.frames[0].document.getElementById('tb2').value = document.getElementById('tb1').value;

And here is a jQuery equivalent, since we're on the subject.

$('iframe:first').contents().find('#tb2').val($('#tb1').val());

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Thanks Nik and thanks Mind. Nik: Just on the off chance, you don't know where I could get this part at cheaper than normal price do you? I tried I few places but the I can find it at is 70GBP? Just gonna have to suck it up and buy the add-on for my PC. Thank you guys.
    • Underwhelming update. Same as 12,13,14,15. Then M3E ain't showing up until Q3
    • Smart Launcher seems a better option right now.
    • Mistral AI's new 'Magistral' models bring traceable, faster AI reasoning by Paul Hill One of Europe’s leading AI companies, Mistral, has announced the availability of its Magistral reasoning model. It comes in two versions: there is the open-source Magistral Small (24B parameters) and the enterprise-focused Magistral Medium. Magistral has been designed to better handle domain-specific tasks such as law, finance, and engineering. It shows users the model’s thought processes so that it’s more transparent, and it supports multilingual reasoning to perform better when tasked with answering non-English queries. Key features and performance Mistral compared its new models against DeepSeek R1 in various benchmarks. Ones that stood out were its results on AIME2024, which assesses reasoning capabilities. Magistral Medium scored 73.6% (90% with majority voting @64) while Small scored 70.7% (83.3% respectively). If you’ve used DeepSeek R1, you’ll have seen it thinking before answering. Magistral now does this too and can do it across multiple languages, including English, French, Spanish, German, Italian, Arabic, Russian, and Simplified Chinese. Interestingly, there’s also a Flash Answers mode that speeds up the thinking for 10x faster responses compared to competitors. Real-world applications and availability Thanks to the expertise Magistral has been trained on, organizations across multiple fields, including legal research, financial forecasting, and regulated industries, may be able to turn to Magistral for more reliable answers. Its traceable reasoning also makes it ideal in regulated fields for compliance and auditability. Magistral Small, the open-source model, is available under an Apache 2.0 license via Hugging Face. Magistral Medium is accessible through Mistral's Le Chat and via API on La Plateforme. It’ll also be arriving soon on Amazon SageMaker, IBM WatsonX, Azure AI, and Google Cloud Marketplace. The easiest way for readers to try it out is on Mistral's Le Chat platform; just head to chat.mistral.ai to get started. Source: Mistral
    • Didn't know this thanks, useful.
  • Recent Achievements

    • Week One Done
      elsa777 earned a badge
      Week One Done
    • One Month Later
      elsa777 earned a badge
      One Month Later
    • First Post
      K Dorman earned a badge
      First Post
    • Reacting Well
      rshit earned a badge
      Reacting Well
    • Reacting Well
      Alan- earned a badge
      Reacting Well
  • Popular Contributors

    1. 1
      +primortal
      544
    2. 2
      ATLien_0
      272
    3. 3
      +FloatingFatMan
      207
    4. 4
      +Edouard
      201
    5. 5
      snowy owl
      139
  • Tell a friend

    Love Neowin? Tell a friend!