I have function in Javascript which works fine using prototype. The function is used to dynamicaly change a select field based on the selection of another field.
var sizes_286 = new Array();
sizes_286.push(new Array(536, Pequeno , 1661));
sizes_286.push(new Array(536, Médio , 1662));
sizes_286.push(new Array(536, Grande , 1663));
sizes_286.push(new Array(536, ExtGrande , 1664));
function varianteSelected_286(){
var_id = $( variante_286 ).getValue();
options = $( tamanho_286 ).options;
options.length = 1;
sizes_286.each(function(size){
if (size[0] == var_id){
options[options.length] = new Option(size[1], size[2]);
}
});
}
document.observe( dom:loaded , function(){
$( variante_286 ).observe( change , varianteSelected_286);
});
The problem is that I started to use jQuery in my project, and since then this function stopped working. I m using jQuery (1.3.2) and prototype (1.6.1).
- How can I create a jquery version of my old function? or
- How can I make it still work after jquery is being loaded?
- Is there a short and more elegant version of the same functionality?