Note that there are some explanatory texts on larger screens.

plurals
  1. POJavascript innerHTML with Popup
    primarykey
    data
    text
    <p>I can't understand why this inner html script isn't working. I posted the javascript on jsFiddle. You can see it here: <a href="http://jsfiddle.net/JyV73/1/" rel="nofollow">http://jsfiddle.net/JyV73/1/</a></p> <p>I have two versions of the link. In the first the rewrite link is within a popup that needs to be closed and another opened with the proper text within the textarea. </p> <p>In the second, there is just a link on the page that when it is clicked should hopefully open the popup with the proper text within wht textarea.</p> <p>The only problem is that it doesn't work for the second version because of I must close the popup. If I comment out that first <code>document.getElementById(id).style.display = 'none'</code> then the plain link works, so my first thought is to create two function. But since this javascript is part of a php template file that is included I think it would be simpler on the php code to just solve this using pure javascript.</p> <p>I'm still learning javascript, and any help would be appreciated. I hope I was clear. Thank you so much.</p> <p>HTML</p> <pre><code>&lt;a href="#popup" rel="popup"&gt;open&lt;/a&gt; &lt;div id="popup" class="popup"&gt; &lt;a href="#new" rel="popup" onClick="rewrite('popup', 'blah')"&gt;Rewrite&lt;/a&gt; &lt;/div&gt; &lt;div id="new" class="popup"&gt; &lt;textarea id="new-text"&gt;&lt;/textarea&gt; &lt;/div&gt; &lt;!-- This is the stuff that doesnt work for some reason &lt;a href="#new" rel="popup" onClick="rewrite('popup', 'blah')"&gt;Rewrite&lt;/a&gt; &lt;div id="new" class="popup"&gt; &lt;textarea id="new-text"&gt;&lt;/textarea&gt; &lt;/div&gt; --&gt; </code></pre> <p>The Javascript</p> <pre><code>function rewrite(id, text) { document.getElementById(id).style.display = 'none'; document.getElementById('new-text').innerHTML = text; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload