1

i have this code and this is not working

<script>
    dialogFun();
            function dialogFun(){

                var code="<div style='font-size: 12px' id='dialog'><script src='https://content.jwplatform.com/libraries/xyz.js'> </script><div id='jwplyr'>Loading the player...</div><script type='text/javascript'>jwplayer('jwplyr').setup({'file': 'http://content.jwplatform.com/videos/xyz-lusPHdHK.mp4','image':'http://content.jwplatform.com/thumbs/xyz-320.jpg'});</script></div>";


                console.log(code);
                $( "body" ).append( code );
            }
</script>

this is not working

Jigar Prajapati
  • 93
  • 1
  • 10

1 Answers1

4

ESCAPE the "/" of closing tags

<script>
    dialogFun();
            function dialogFun(){

                var code = "<div style='font-size: 12px' id='dialog'>"+
                "<script src='https://content.jwplatform.com/libraries/xyz.js'><\/script>"+
                "<div id='jwplyr'>Loading the player...</div>"+
                "<script type='text/javascript'>jwplayer('jwplyr').setup({'file': 'http://content.jwplatform.com/videos/xyz-lusPHdHK.mp4','image':'http://content.jwplatform.com/thumbs/xyz-320.jpg'});<\/script><\/div>";


                console.log(code);
                $( "body" ).append( code );
            }
</script>
ZiTAL
  • 3,466
  • 8
  • 35
  • 50