How do I load a script into a page, the result appears in div
?
Example:
<script type="text/javascript">
/*
conteúdo do script
*/
</script>
<div id="script" class="000000"></div>
The goal is for script to load on the page, its result will appear where div
is located.
I have an example here:
<div id="video" class="UJAwNkhbYWM"></div>
<iframe width="854" height="510" ID="caixa" frameborder="0" allowfullscreen></iframe>
<script>
var video = $("#video").attr('class');
$('#caixa').attr('src', "https://www.youtube.com/embed/" + video);
</script>
With this code you can do this with a Youtube video, but I would like to do the same with a script . Trying to clarify a little more ....
Let's look at the example of Lightbox that is used to view images. This script snippet:
$("a[href$='.jpg'], a[href$='.png'], a[href$='.jpeg'], a[href$='.gif']").fancybox();
It indicates that by loading script , and it finds images with the ending, .jpg
, .png
and others it will do the desired effect.
In the case of a script I wanted it to run as a div
specified.
Type it finds the .png
image, but it will show it on the Sidebar for example, why script found div
there.