Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type='text/javascript' src='http://code.jquery.com/ui/1.9.1/jquery-ui.min.js'></script> ( just before </head> )
- Also
- IsItChristmas is disabled="true" but it just doesn't appear - would prefer that it did but dimmed and unclickable
- <div class="demo">
- <div class="ui-widget">
- <select id="combobox1">
- <option value="">Select one...</option>
- <option value="http://www.somethingstore.com">SomethingStore</option>
- <option value="http://z0r.de/">Zor</option>
- <option value="http://wwwwwwwww.jodi.org">Jodi</option>
- <option value="http://www.youfellasleepwatchingadvd.com">FellAsleep</option>
- <option value="http://www.staggeringbeauty.com">Staggering</option>
- <option value="http://www.theuselessweb.com">Useless</option>
- <option value="https://isitchristmas.com" disabled="true">IsItChristmas</option>
- <option value="http://www.timecube.com">TimeCube</option>
- <option value="http://zombo.com">Zombo</option>
- <option value="http://www.pointerpointer.com">Pointer</option>
- <option value="http://www.fearthegaychicken.org">FeartheGayChicken</option>
- <option value="http://www.pixyland.org/peterpan/">Peter Pan</option>
- <option value="http://heyyeyaaeyaaaeyaeyaa.com">HeHa</option>
- <option value="http://www.godhatesshrimp.com">God Hates Shrimp</option>
- <option value="http://www.koalastothemax.com">Koalas To The Max</option>
- <option value="http://www.drunkronswanson.com">Infinite Drunk Ron</option>
- <option value="http://www.patience-is-a-virtue.org">Patience is a Virtue</option>
- <option value="http://www.brainwash.com/cameras.htm">BrainWash</option>
- <option value="http://www.feedthehead.net">Feed the Head</option>
- <option value="http://cat-bounce.com">Bouncing Cats</option>
- <option value="http://www.shayesaintjohn.net">Shayes Store</option>
- <option value="http://111111111111111111111111111111111111111111111111111111111111.com">The One and Only One</option>
- <option value="http://www.michaeljfoxnews.com">Not Fox News</option>
- <option value="http://procatinator.com">More Cats</option>
- <option value="http://www.whitepowermilk.com">White Power Milk</option>
- <option value="http://www.jimcarrey.com">Jim Carrey</option>
- <option value="http://tane.us">Tane</option>
- <option value="http://www.cookevillepolice.com">Cookville Police Dept.</option>
- <option value="http://jaredpadaleckisass.com">Jared Padaleckisass</option>
- <option value="http://www.wwwdotcom.com">The End</option>
- <option value="http://iloveyoulikeafatladylovesapples.com">Fat Lady Love Apples</option>
- <option value="http://www.rainymood.com">Rainy Mood</option>
- <option value="http://www.simonpanrucker.com/beans.swf">Screamin' Beans</option>
- <option value="http://www.thisman.org">Ever Dream This Man</option>
- <option value="http://thequietplaceproject.com/thequietplace">The Quiet Place</option>
- <option value="http://thenicestplaceontheinter.net">The Nicest Place on the Internet</option>
- <option value="http://www.hosanna1.com">Jumble Book</option>
- <option value="http://www.haneke.net">Haneke</option>
- <option value="http://thebeatlesneverbrokeup.com">Beatle Reborn</option>
- <option value="http://www.ilooklikebarackobama.com">Obama Lookalike</option>
- <option value="http://momspaghetti.ytmnd.com">Mom's Spaghetti</option>
- <option value="http://www.youshouldhaveseenthis.com">See This?</option>
- <option value="http://postsecret.com">Post Secret</option>
- <option value="http://www.venganza.org">Church of the Flying Spaghetti Monster</option>
- <option value="http://failblog.cheezburger.com">Fail Blog</option>
- <option value="http://www.rathergood.com">Rather Good</option>
- <option value="http://icanhas.cheezburger.com">Cheezburger</option>
- <option value="http://www.fugly.com">Fugly</option>
- <option value="http://www.dictionaryofobscuresorrows.com">Dictionary of Obscure Sorrows</option>
- <option value="http://www.wwwdotcom.com">The End</option>
- </select>
- </div>
- <script type="text/javascript">
- (function( jQuery ) {
- jQuery.widget( "ui.combobox", {
- _create: function() {
- var input,
- self = this,
- select = this.element.hide(),
- selected = select.children( ":selected" ),
- value = selected.val() ? selected.text() : "",
- wrapper = this.wrapper =jQuery( "<span>" )
- .addClass( "ui-combobox" )
- .insertAfter( select ); input = jQuery( "<input>" )
- .appendTo( wrapper )
- .attr('placeholder', 'Go to .....')
- .attr('onfocus', 'if(this.placeholder == "Go to .....") {this.placeholder = "";}')
- .attr('onblur', 'if(this.placeholder == "") {this.placeholder = "Go to .....";}')
- .val( value )
- .addClass( "ui-state-default ui-combobox-input" )
- .autocomplete({
- delay: 0,
- minLength: 0,
- source: function( request, response ) {
- var matcher = new RegExp( jQuery.ui.autocomplete.escapeRegex(request.term), "i" );
- response( select.children( "option" ).not(':disabled').map(function() {
- var text = jQuery( this ).text();
- if ( this.value && ( !request.term || matcher.test(text) ) )
- return {
- label: text.replace(
- new RegExp(
- "(?![^&;]+;)(?!<[^<>]*)(" +
- jQuery.ui.autocomplete.escapeRegex(request.term) +
- ")(?![^<>]*>)(?![^&;]+;)", "gi"
- ), "<strong>$1</strong>" ),
- value: text,
- option: this
- }; }) );
- },
- select: function( event, ui ) {
- //alert( comboBoxThis.attr("id") );
- //if( jQuery(this).attr("id") == "combobox1")
- //document.location.href=ui.item.option.value;
- ui.item.option.selected = true;
- self._trigger( "selected", event, {
- item: ui.item.option
- });
- },
- change: function( event, ui ) {
- if ( !ui.item ) {
- var matcher = new RegExp( "^" + jQuery.ui.autocomplete.escapeRegex( jQuery(this).val() ) + "$", "i" ),
- valid = false;
- select.children( "option" ).each(function() {
- if ( jQuery( this ).text().match( matcher ) ) {
- this.selected = valid = true;
- return false;
- }
- });
- if ( !valid ) {
- // remove invalid value, as it didn't match anything
- jQuery( this ).val( "" );
- select.val( "" );
- input.data( "autocomplete" ).term = "";
- return false;
- }
- }
- }
- })
- .addClass( "ui-widget ui-widget-content ui-corner-left" );
- input.data( "autocomplete" )._renderItem = function( ul, item ) {
- return jQuery( "<li></li>" )
- .data( "item.autocomplete", item )
- .append( "<a href='"+ item.option.value +"'>" + item.label + "</a>" )
- .appendTo( ul ); }; jQuery( "<a>" )
- .attr( "tabIndex", -1 )
- .attr( "title", "Show All Items" )
- .appendTo( wrapper )
- .button({
- icons: {
- primary: "ui-icon-triangle-1-s"
- },
- text: false
- })
- .removeClass( "ui-corner-all" )
- .addClass( "ui-corner-right ui-combobox-toggle" )
- .click(function() {
- // close if already visible
- if ( input.autocomplete( "widget" ).is( ":visible" ) ) {
- input.autocomplete( "close" );
- return;
- }
- // work around a bug (likely same cause as #5265)
- jQuery( this ).blur();
- // pass empty string as value to search for, displaying all results
- input.autocomplete( "search", "" );
- input.focus();
- });
- }, destroy: function() {
- this.wrapper.remove();
- this.element.show();
- jQuery.Widget.prototype.destroy.call( this );
- }
- });
- })( jQuery ); jQuery(function() {
- jQuery( "#combobox, #combobox1" ).combobox();
- jQuery( "#toggle" ).click(function() {
- jQuery( "#combobox, #combobox1" ).toggle();
- });
- jQuery(document).ready(function(){
- jQuery('.ui-autocomplete:first').addClass('hCombo');
- jQuery('.hCombo li a').live('click',function(){
- var cId = jQuery('.demo').find('select ').attr('id');
- // alert( jQuery(this).attr('href') );
- document.location.href= jQuery(this).attr('href');
- });
- });
- });
- //alert(jQuery('.demo').html());
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement