I am wondering if anyone has any experience using a jQuery plugin that converts html
<select> <option> Blah </option> </select>
a combo box into something (possibly a div) where selecting an item acts just like clicking a link.
I assume that you could probably use javascript to handle the selection event (my javascript knowledge is a bit undecided at the moment) and "switch" to the value of the combo box, but it looks like a hack.
Your advice, experience and recommendations are welcome.
A simple solution is to use
$("#mySelect").change(function() { document.location = this.value; });
onchange , URL-, .
, , Div, , - , , :
<select id="mySelect"> <option value="1">Option 1</option> <option value="2">Option 2</options> </select> <div id="myDiv"/>
JQuery <div>, a URL-, :
<div>
$("#mySelect option").each(function() { $("<div>" + $(this).text() + "</div>").appendTo($("#myDiv")).bind("click", $(this).val(), function(event) { location.href = "goto.php?id=" + event.data; }); }); $("#mySelect").remove();
, ?
, , , - :
$("[id*='COMMON_NAME']").change(function() { document.location = this.value; });
:
<select id="COMMON_NAME_001">...</select> <select id="COMMON_NAME_002">...</select>
onchange , "COMMON_NAME", <option>.
<option>
javascript 'select':
onchange="if(this.options[this.selectedIndex].value!=''){this.form.submit()}"
This is not ideal (because the form submissions in ASP.NET MVC that I use do not use the routing mechanism for URLs), but it does its job.