Hey guys,
I want to have sth. like this here:
Select a page
foo
bar
blubI realized that with a little javascript code:
$("#edit-jump-goto option:first").before("<option selected=\"selected\">Select a category</option><option></option>");
But that's bullshit cause if I click on the placeholder the jump.module wants to go to myurl.com/.
What can I do here?
yannick
Comments
Comment #1
pontus_nilssonYou could add a option with the value "0" to the select list and in when you redirect you check for values that are not 0:
This code should go in to a .js file added to your themes .info file.
This code will also trigger a redirect when selecting one of the values. To remove the Go button you could add some css to your theme.
html.js .jump-quickly input { display:none; }I use the code above for external links. If your links are internal (node/10) then you could add something like:
window.location = Drupal.settings.basePath + selected.val();Comment #2
hessam61 commentedHey,
Thanks for this code, but it didn't work for me. Am I supposed to change ".shortcutmenu-processed" ? Is this in your markup? Also I am using internal pages, and as you suggested I replace the line you mentioned. Here's my code that I am adding to a js file in drupal 6.19:
Thanks,
Comment #3
pontus_nilssonIt is this line you will need to change:
$('#edit-jump-goto select:not(.shortcutmenu-processed)', context)where
#edit-jump-gotois the ID for the selector the shortcut menu you want this script to work on.Later after i replied to you I found the module Special Menu Items which can create placeholder items in menus.
Comment #4
hessam61 commentedThanks for replying. The div id in my markup happens to be the same as yours. I solve the problem with this jQuery:
Comment #5
yannickooSimilar to my code ;)
$("#edit-jump-goto option:first").before("<option selected=\"selected\">Select a category</option><option></option>");Comment #6
marcp commentedThis is now a duplicate of #270924: Jump without "Go" Button which will incorporate something similar in the 2.x branch.
Comment #7
doublejosh commentedIs this planned to allow for Special Menu items that end up as OptGroups or non-functional options, etc.?
I have some code to contribute, but want to match up to share best :)