Hello:) ,

$.each(myOptions, function(val, text) {
   $('#select').append($('<option></option>').val(val).html(text));				
});

how can I add to option links for example to http://google.pl/search?q={text}

thx 4 help;)

You mean as soon as the user selects the option you want him to jump to the particular website? :-/

yes

$.each(myOptions, function(val, text) {
   $('#select').append($('<option></option>').val(val).html(text).attr("onclick","window.open('http://google.pl/search?q='"+text+"')));				
});

PS: I havent tried it.

but how to open page in the same window?

$.each(myOptions, function(val, text) {
   $('#select').append($('<option></option>').val(val).html(text).attr("onclick","window.location='http://google.pl/search?q='"+text+"';));				
});

Use this then.

doesn't work, website is open in new window/tab

use the new edited version. I had mistakingly used "open" instead of "location".

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.