RunSomejQueryCommands() - Put whatever jQuery statements that need to be run after jQuery finishes loading
Note: the code loads jQuery into the page only if it is Not already there
Below example - in google.com page, clicking on the bookmarklet will load jQuery and put the text "jQuery loaded...Inserted via jQuery" into the Search box
Note: the code loads jQuery into the page only if it is Not already there
Below example - in google.com page, clicking on the bookmarklet will load jQuery and put the text "jQuery loaded...Inserted via jQuery" into the Search box
javascript:if (typeof jQuery == 'undefined') { var s=document.createElement('script');s.setAttribute('src', '//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js');document.getElementsByTagName('body')[0].appendChild(s);} var WaitTilljQueryLoads = function() { if (typeof jQuery != 'undefined') { clearInterval(timer);RunSomejQueryCommands(); }}; var timer = setInterval(WaitTilljQueryLoads);void(s);var RunSomejQueryCommands = function() {$('[name=q]').val('jQuery loaded...Inserted via jQuery');};
No comments:
Post a Comment