views:

76

answers:

1

I have code:

$(function() {
        $("#dialog").dialog({
            bgiframe: true,
            autoOpen: false,
            height: 300,
            modal: true,
            buttons: {
                Cancel: function() {
                    $(this).dialog('close');
                }
            },
            close: function() {
                allFields.val('').removeClass('ui-state-error');
            }
        });

        $("input[name=edit]").click(function() {
            alert(1);
            $("#dialog input[@id=ItemId]").val($("ItemId"));
            alert(2);
            $("#dialog input[@id=CatId]").val($("CatId"));
            $("#dialog input[@id=UnitId]").val($("UnitId"));
            $("#dialog input[@id=SaleOffId]").val($("SaleOffId"));
            $("#dialog input[@id=ItemCode]").val($("ItemCode"));
            $("#dialog input[@id=ItemName]").val($("ItemName"));
            $("#dialog input[@id=UnitCost]").val($("UnitCost"));

            $('#dialog').dialog('open');
        })
    .hover(
        function() {
            $(this).addClass("ui-state-hover");
        },
        function() {
            $(this).removeClass("ui-state-hover");
        }
    ).mousedown(function() {
        $(this).addClass("ui-state-active");
    })
    .mouseup(function() {
        $(this).removeClass("ui-state-active");
    });
    });

I want to set value for dialog which is support from Form. I wrote function $("input[name=edit]").click(function() to set value to dialog each button edit is click but it wrong. i don't know i where i wrong.please help me

Thanks

+1  A: 

If you are using jQuery 1.3 start by removing @ sings from your attribute selectors.

$("#dialog input[@id=CatId]")

should become

$("#dialog input[id=CatId]")

Quote from jQuery docs:

Note: In jQuery 1.3 [@attr] style selectors were removed (they were previously deprecated in jQuery 1.2). Simply remove the '@' symbol from your selectors in order to make them work again.

An even better improvement is to change

$("#dialog input[id=CatId]")

to

$("#CatId")

since ids must be unique.

RaYell