WebsiteBaker Community Forum

WebsiteBaker Support (2.8.x) => jQuery => Topic started by: kettrich on April 07, 2011, 10:09:58 AM

Title: How to check selected options in bakery with jquery
Post by: kettrich on April 07, 2011, 10:09:58 AM
I am just a beginner with jquery but what I need should not be too difficult to realize.
There are 3 dropdown select fields on the detail page of a bakery shop. If you open the detail page only one dropdown select is shown. Depending on what option will be selected the second and third dropdown select boxes differ.
So I need to find out what first is choosen and then get all the refering items and show them.
if I test my little jquery on a simple html file it works but it does not within bakery in view_item.php.
Can you tell me what to do to get it work.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <title></title>
  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
  <script type="text/javascript">
$(document).ready(function(){   
   $('select#option').click(function(){
      $('#optionen2').click(function(){
        alert($('#optionen2').val());
      });
   });
});
</script>
  </head>
  <body>
    <form action="" method="post">
               
         <select id='option' name='attribute[]' class='mod_bakery_item_sel ect_f'>      
            <option id='optionen1' value='1'>nama1</option>
            <option id='optionen2' value='2'>nama2</option>
            <option id='optionen3' value='3'>nama3</option>
            <option id='optionen4' value='4'>nama4</option>
         </select>   
   </form>         
            
     </body>
</html>