-1

I have read many of the articles on using jquery to find and append. I have been successful at doing this on other projects, but mostly appending to a div element. I need to append to javascript on the page that unfortunately I don't have core access to.

Existing JS:

<div class="widget">
 <script type="text/javascript">
      var widget37 = new VideoWidget("VideoCanvas",                            
     "divVideoCanvas37", "DS37");
      widgetVideoCanvas37.SetWidth("630");
      widgetVideoCanvas37.SetHeight("355");
      widgetVideoCanvas37.SetVariable("isMute", "false");
      widgetVideoCanvas37.RenderWidget();
  </script>
 </div>

Before the RenderWidget, I need to add

 widgetVideoCanvas37.SetVariable("isAutoStart", "true");

I've tried something like this:

$( "widgetVideoCanvasDS37.RenderWidget()" ).prepend( "<p>Test</p>" );

but it does appear to be working. Maybe prepend isn't the best way to do this. Thanks in advance for the help!

Joey Martin
  • 369
  • 1
  • 3
  • 11
  • 1
    This feels very sketchy overall. Why don't you just set the variable with your script, instead of trying to append it to the DOM? – random_user_name Jul 31 '15 at 17:16
  • Just to clarify, there is a limitation from our core CMS. I have access to adding my own code that is called after their core code. I can't get their developers to fix what I want, as quick as I need it done, hence why I am trying to to do it myself. – Joey Martin Jul 31 '15 at 17:54

1 Answers1

0

The element would be selected like $('script').appened('blah'); But i feel that that probably won't or shouldn't work. That be a very large security flaw if i was able to run my own script locally to append JavaScript to the script element of another page that i don't have core access to.

Eric
  • 505
  • 5
  • 22