javascript - jQuery conflict when removing div after page load -


i'm trying remove div page (preferably prevent loading @ all) i'm settling on removing after page loads.

when try following lines of code in jsfiddle, #content div gets removed, expected.

<script type='text/javascript'>//<![cdata[    $(window).load(function(){       $('#content').remove();   });//]]>   </script> 

however, have tried implementing on an actual website, in case, #content div isn't removed.

any suggestions might wrong?

if you're sharing jquery library uses dollar operation need guard against this, using anonymous wrapper:

(function($) {     $(window).on('load', function(){         $('#content').remove();     }); }(jquery)); 

note instead of .load() i'm using .on('load', fn).

instead of on page load bind code on dom ready; jquery passes first argument inner function:

jquery(function($) {     $('#content').remove(); }); 

Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -