Is this a good idea in coding?
- function show_quantity(){
jQuery(this).click(function(){
jQuery('.quantity').live('click',function(){
jQuery('.quantity_A').show("fast");
jQuery(".option_q").click(function(){
var c = jQuery(this).text();
//Quantity Field condition
jQuery(".quantity").val(c);
switch(c){
case '6':
jQuery('.price').val("12.00");
break;
case '12':
jQuery('.price').val("22.00");
break;
case '18':
jQuery('.price').val("34.00");
break;
case '24':
jQuery('.price').val("44.00");
break;
case '30':
jQuery('.price').val("56.00");
break;
case '36':
jQuery('.price').val("66.00");
break;
case '42':
jQuery('.price').val("78.00");
break;
}
//Hide the dropdown after clicking the text
jQuery('.option_q').hide("fast");
});
-
});
});
}
- Then call it like this.
switch (imageId) {
case "id_40":
//with_frost();
show_quantity();
jQuery(this).click(function(){
jQuery('.frostselect').hide();
});