0

In the code below you can see the "89%". I would like to replace that number with the value from a TextBox from my Website. How is this possible, been Looking for solutions online but havent suceed so far. The code below is used for a html i frame.


  <head>

    <style type="text/css">
        .outer {
            position: relative;
            width: 600px;
            height: 400px;
        }

        canvas {
            position: absolute;
        }

        .percent {
            position: absolute;
            left: 50%;
            transform: translate(-50%, 0);
            font-size: 80px;
            bottom: 0;
        }
    </style>


</head>


<body>
    <div class="outer">
        <canvas id="chartJSContainer" width="600" height="400"></canvas>
        <canvas id="secondContainer" width="600" height="400"></canvas>
        <p class="percent">
            89%
        </p>
    </div>

    </body>
  • Does this answer your question? [jQuery/JavaScript: accessing contents of an iframe](https://stackoverflow.com/questions/364952/jquery-javascript-accessing-contents-of-an-iframe) – ロバート May 20 '20 at 21:20

1 Answers1

0

I tried the following solution. I have the orignal Website and two iframes. On the first iframe (html1) you can find a graph, which consits of the code above (and more code), where I would like to put in the number of the text box (instead of 89% --> see code above)). I then put up another ifram (html2) from where I would like to Access the TextBox, since from the original Website this doesnt seem to work. As a result I have the code below which is from iframe1. Am I on the wrong path at all or is i it a coding mistake Im doing?

<p class="percent">

<script>
   $( document ).ready( function(){

      var iframe = document.getElementById("#html2");
var elmnt = iframe.contentWindow.document.getElementsByTagName("#input4");

   });

</script>

 </p>