When a [name="tip"] has the first value, display a specific element, otherwise it would display another element.
Both elements have the display:none property. When I load the page I check the select value and fadeIn the desired element automatically.
Everything works fine except when I try to change the selected option: nothing happens. I added both javascript onchange to that item and jquery .change() and nothing happens. Can you tell me why it does not work in my example?
<form id="fm-account-properties-tab" method="POST">
<table width="300px" style="margin-top:10px;" align="center" >
    <tr>
        
        <td align="left">
        <select class="easyui-combobox" name="tip" style="width:200px;" class="easyui-validatebox" required="true" onchange="changeType();">
                    <option value="l1">l1</option>
                    <option value="l2">l2</option>
                    <script>
                        $(document).ready(function(){
                            $('[name="tip"]').val('<?php echo $a['tip'];?>');
                        });
                    </script>
        </select>
        </td>
    </tr>
    <tr id="l1" style="display:none">
        <td align="left">
        <select class="easyui-combobox" name="l1"  style="width:200px;" class="easyui-validatebox" required="true">
                    
        </select>
        </td>
    </tr>
    <tr id="l2" style="display:none">
        <td align="left">
        <select class="easyui-combobox" name="l2"  style="width:200px;" class="easyui-validatebox">
                    
                    
        </select>
        </td>
    </tr>
</table>
</form>
<script>
function changeType()
{
if($('[name="tip"]').val()=='l1')
    {
    $('#l1').fadeIn();
    $('#l2').hide();
    }
else
    {
    $('#l2').fadeIn();
    $('#l1').hide();
    }
}
$(document).ready( function () {
        
        changeType();
            $('[name="tip"]').change(function(){ alert('1');});//it never alerts me
    });
 
     
     
     
     
    