5 Replies Latest reply on Oct 3, 2013 9:48 AM by Gil1

    How to listen to changes in a combobox?

    Gil1 Level 1

      I have created a combobox with the following code:

       

      var countries = ['Brazil', 'Mexico', 'Argentina', 'Colombia', 'Venezuela', 'Peru', 'Chile', 'Ecuador', 'Dominican Republic', 'Guatemala', 'Costa Rica','Uruguay','Bolivia','Panama','El Salvador','Paraguay','Honduras','Trinidad and Tobago','Jamaica','Nicaragua','Haiti','The Bahamas','Barbados','Guyana','Suriname','Belize','Saint Lucia','Antigua and Barbuda','Grenada','Saint Vincent and the Grenadines','Dominica','Saint Kitts and Nevis'];

       

       

      var country = sym.$("country");

      var options = '';

      for(var i = 0; i < countries.length; i++) {

          var opt = countries[i];

          options += '<option>'+opt+'</option>'

      }

       

       

      var inputCountry = $('<select id="selectNumber"><option>Totals</option>'+options+'</select>');

      inputCountry.css ('width', 120);

      inputCountry.appendTo(country);

       

      This works as expected. However, I don't know how to listen to the changes on the combobox.

      Any suggestions?