lior r
lior r

Reputation: 2290

HTML select box with images using jquery

I need to create an HTML drop down that will display flags of countries. The only solutions i found was with jquery and it generated a list of links from a select box.

The problem is i don't want to link the user to a different page , i want to later use the selected value on form submit (like a simple select box)

How can i do that ?

Thanks

Upvotes: 2

Views: 18835

Answers (3)

solendil
solendil

Reputation: 8458

Something like this should do the trick:

$(".myFlagItem").click(function() {
    $(".myHiddenInputBox").val($(this).attr("flagValue"));
})

Upvotes: 0

martincarlin87
martincarlin87

Reputation: 11052

I've used this plugin in the past - hopefully it does the trick for you (unless it's one you've already tried):

http://www.marghoobsuleman.com/jquery-image-dropdown

Upvotes: 3

Itay Kinnrot
Itay Kinnrot

Reputation: 721

you can get the value you need from the jquery control and put it in a hidden field in the form you want to submit.

Upvotes: 0

Related Questions