I am using this script to apply style on a select box. It works fine as a standalone version.
But I also need to apply a jump menu functionality on this select box. I tried adding a function but it seems that there is some conflict between the two scripts. The jquery styling and the jump menu function can’t work together at the same time.
Can you help me fix it? This is a sample code to let you know what I’m dealing with here:
<script type="text/javascript">
$(document).ready(function() {
$('#jumpMenu').selectbox({debug: true});
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
});
</script>
<select name="jumpMenu" id="jumpMenu" onchange="MM_jumpMenu('parent',this,0)">
<option value="http://www.link1.com">link1</option>
<option value="http://www.link2.com">link2</option>
<option value="http://www.link3.com">link3</option>
</select>
The problem is rather obvious. selectbox plugin creates a div that is presented instead of the select so that it can be styled.
Get a firebug addon and see for Yourself.
Therefore no onchange is being fired. You have to get to the guts of the plugin and find a place to put a callback function that would trigger Your onchange actions.
See if the plugin provides an option for passing callbacks.