Search code examples
jquery-easyui

JS error: SyntaxError: expected expression, got '}'


I use JEasyUI combo box and I have it configured liked this:

<input class="easyui-combobox" name="work_groups" id="work_groups"
   data-options="
        url:'pages/get_work_groups.php',
        method:'get',
        valueField:'work_group_id',
        textField:'work_group',
        panelHeight:'auto',
        onLoadSuccess: function(){
          $('#work_groups').combobox('setValue', '1');
        },
        onSelect: function(rec){
          alert("test");
        }

">

but because of the alert() I get an error: enter image description here

Why I get this error ?


Solution

  • This is simple. You are closing the string where it should still be going. Quotes mistaken:

    <input class="easyui-combobox" name="work_groups" id="work_groups"
       data-options="
            url:'pages/get_work_groups.php',
            method:'get',
            valueField:'work_group_id',
            textField:'work_group',
            panelHeight:'auto',
            onLoadSuccess: function(){
              $('#work_groups').combobox('setValue', '1');
            },
            onSelect: function(rec){
              alert('test');
            }
    
    ">