AlreadyM / jscrollpane

Automatically exported from code.google.com/p/jscrollpane
0 stars 0 forks source link

jscrollpane writes to screen any JS document.write found in target div #213

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1.Create div with document.write('test');
2. apply jscrollpane  it
3. See double word 'test' on the page

Any browser

Original issue reported on code.google.com by LevSavra...@gmail.com on 5 Aug 2010 at 9:11

GoogleCodeExporter commented 9 years ago
What is happening is that when jScrollPane wraps the div in a container div 
(which is necessary for jScrollPane to work), the div is removed and re-added 
to the document. It appears that the javascript in the div is re-executed when 
this happens.

As a workaround in your case you could do a couple of things:

 * Don't use document.write in the div (use $('#element').html('test') from a document ready instead).
 * Clear the script tags before initialising jScrolPane something like:

$('#element').find('script').remove().end().jScrollPane();

Hope it helps,

Kelvin :)

Original comment by kelvin.l...@gmail.com on 5 Aug 2010 at 9:30

GoogleCodeExporter commented 9 years ago
it totally helped!

cheers!

Original comment by LevSavra...@gmail.com on 5 Aug 2010 at 9:40