Jump to content

Javascript InnerHTML - How to output not as plain text

Recommended Posts

Hello everyone!!! I have install a joomla plugin by the name AllVideos Plugin. All I have to do is to put some tags like this {youtube}h2TLC0zGwKE{/youtube} somewhere in to my site and my video shows up!!! In this point I need your help... In to my php code I have add a hidden textbox that holds video's source and a div that will show video when I click on an image using javascript.Part of PHP code

<input id="video_url" name="video_url" type="hidden" value="" /><div id="video"></div>

Part of JAVASCRIPT code

var Open      = String.fromCharCode(123,121,111,117,116,117,98,101,125); // {youtube}var Close     = String.fromCharCode(123,47,121,111,117,116,117,98,101,125); // {/youtube}var video     = document.getElementById("video");var video_url = document.getElementById("video_url");...video.innerHTML =  Open+video_url.value+Close;

The problem is that youtube tags appear just as plain text! Take a look at this image:



Any idea how I will make it work??? Thank you in advance!!!

Edited by DNA180
Link to post
Share on other sites

The problem is that the calling of plugin is run on page load and processed by server language php, which is replaced with video html code to show the video.


Quick solution is that you hide the generated html code to show video, within a container with specific id ref of some sort, and when you click the image with corresponding id, drag that code into the div with id video.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...