1
votes

Please help me for resolving the jquery error.

$('#<%=drpMasters.ClientID%>').change(function () {
        $('#divLeadSource').css("display", "none");
        $('#divAccount').css("display", "none");
        $('#divContact').css("display", "none");
        $('#divLeadStatus').css("display", "none");
        $('#divSupplier').css("display", "none");

        var element = $(this).find('option').filter(':selected').val();

        switch (element) {
            case "1":
                $('#divLeadSource').css("display", "block");
                $('#<%=lblQuickHead.ClientID%>').val("New Lead Source");
                break;
            case "2":
                $('#divAccount').css("display", "block");
                $('#<%=lblQuickHead.ClientID%>').val("New Account");
                break;
            case "3":
                $('#divContact').css("display", "block");
                $('#<%=lblQuickHead.ClientID%>').val("New Contact");
                break;
            case "4":
                $('#divLeadStatus').css("display", "block");
                $('#<%=lblQuickHead.ClientID%>').val("New Lead Status");
                break;
            case "5":
                $('#divSupplier').css("display", "block");
                $('#<%=lblQuickHead.ClientID%>').val("New Supplier");
                break;
            default:

        }

    });
1
Please help us first by telling us what exactly the problem is. Any more details in the error message? - deceze
Run the code in browser with JS debugger like Firefox or Chrome and see what line is causing this error. Without it, we're in the dark here. - Shadow Wizard Is Vaccinated V3

1 Answers

0
votes

The "object expected" error usually means that you have a stray comma somewhere but I don't see how that could be your problem here. The only possibility I can see in your code is this:

switch (element)

If this chain

$(this).find('option').filter(':selected')

doesn't find anything then you'll end up with element having an undefined value and IE may be upset that you are trying to switch on an undefined value.

This is my best guess without a functional example.