Created
May 19, 2011 04:57
-
-
Save maxim75/980216 to your computer and use it in GitHub Desktop.
Add autocomplete to text field on any website with bookmarklet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
var css_selector = 'input.tinput'; | |
var type = '/location/australian_suburb'; | |
if (!(window.jQuery)) { | |
script = document.createElement( 'script' ); | |
script.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js'; | |
document.body.appendChild(script); | |
link = document.createElement( 'link' ); | |
link.type = 'text/css'; | |
link.rel = 'stylesheet'; | |
link.href = 'http://freebaselibs.com/static/suggest/1.3/suggest.min.css'; | |
document.body.appendChild(link); | |
script2 = document.createElement( 'script' ); | |
script2.src = 'http://freebaselibs.com/static/suggest/1.3/suggest.min.js'; | |
script2.onload=startJQuery; | |
document.body.appendChild(script2); | |
} | |
else { | |
startJQuery(); | |
} | |
function startJQuery() { | |
jQuery.noConflict(); | |
jQuery('head').append('<style>.fbs-pane { z-index: 1000; }</style>" />'); | |
jQuery(css_selector).suggest({type:type}); | |
} | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment