3 Replies Latest reply: Aug 2, 2010 3:50 AM by 843833 RSS

    Problem with editable combo box and creating dynamic table values using js

    843833
      Hai

      I have used jquery.jec.js to make my dropdown list as editable... I need to create dynamic table values on the onChange event of dropdown using javascript.

      Now am facing the problem in it...

      I am getting duplicate rows in the table... think(assumption) this jquery.jec.js is calling the dropdown again creating duplicate values...

      Please help me out.... Any help is appreciable... Thanks in advance
        • 1. Re: Problem with editable combo box and creating dynamic table values using js
          843833
          Maybe before the refilling of the list You need to clean it?
          • 2. Re: Problem with editable combo box and creating dynamic table values using js
            843833
            Thanks elOpalo, for your valuable response....

            I have found the correct way of doing.

            Before i had my code like this,
            <html>
            <head>
            <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
            <title>test</title>

            <script type="text/javascript" src="js/jquery-latest.js"></script>
            <script type="text/javascript" src="js/jquery.jec.js"></script>
            <script type="text/javascript">
            $(function(){

            $('#list').jec();

            });
            function giveAlert(){
                 alert('hello');
            }
            </script>
            </head>
            <body>
            <form>
            Combo Box:
            <select id="list" name="list" onChange="giveAlert();">
            <option value="1">one</option>
            <option value="2">two</option>
            </select>

            </form>
            </body>
            </html>


            Now i have changed as the following,
            <html>
            <head>
            <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
            <title>test</title>

            <script type="text/javascript" src="js/jquery-latest.js"></script>
            <script type="text/javascript" src="js/jquery.jec.js"></script>
            <script type="text/javascript">
            $(function(){
            $('select.combo').jec();

            $('select.combo')

            .change(function() {
            alert($(this).val());
            }).change();
            });


            </script>
            </head>
            <body>
            <form>
            <table>
            <tr>
            <td>Combo Box:</td>
            <td><select class="combo"><option value="b">banana</option><option value="a">apple</option></select></td>
            </tr>
            </table>
            </form>
            </body>
            </html>

            The problem is with the function i have called on the onChange Event.. Now i have defined it inside the jquery function of dropdown to make it as editable...