1

我尝试通过属性值选择元素,如下所示:

var item = jQuery("[name='directorSequence']");

但我不知道如何实际获取属性的值"aria-valuenow="......在本例中为 4。

谁能帮我一把?

编辑 -

这是代码的其余部分:

detailRow.find(".directorsOrRecipients").kendoGrid({
    reorderable: true,
    resizable: true,
    dataSource: {
        transport: {
            read: {
                url: "http://z/x/api/Awards/directors/" + awardTitleId,
                type: "GET"
            },
        },
        schema: {
            model: {
                id: "AwardDirectorId",
                fields: {
                    "AwardDirectorId": { editable: false, type: "number", nullable: true },
                    "namefirstlast": { editable: true, type: "string" },
                    "directorsequence": { editable: true, type: "number", validation: { min: 1 } },
                    "isonballot": { editable: true, type: "string" },
                    "concatenation": { editable: true, type: "string" },
                    "MoreNames": { editable: true, type: "number", validation: { min: 0 } },
                }
            }
        }
    },
    columns: [
        { field: "AwardDirectorId", title: "Award Director Id", hidden: true },
        { field: "namefirstlast", title: "Name", editor: namesAutoComplete },
        { field: "directorsequence", title: "Director Sequence", format: "{0:n0}" },
        { field: "isonballot", title: "On ballot?", editor: onBallotDropDownEditor },
        { field: "concatenation", title: "Concatenation" },
        { field: "MoreNames", title: "More names?", format: "{0:n0}" },
        { command: ["edit"], title: " ", width: 100 }],
    sortable: true,
    sort: { field: "namefirstlast", dir: "desc" },
    editable: "inline",
    toolbar: [{ name: "create", text: "Add New Director/Recipient" }],
    save: function(e)
    {
        debugger;

        $(document).ready(function()
        {
            debugger;
            var item = jQuery("[name='directorSequence']");
            var x = item.attr("aria-valuenow");
        });



        $.ajax({
            url: "http://localhost/Take3/api/awards/directors",
            type: "POST",
            dataType: "json",
            data: $.parseJSON(directorData)
        }).done(function()
        {
            detailRow.find(".directorsOrRecipients").data("kendoGrid").refresh();
        });
    },
    edit: function()
    {
    }
});
4

2 回答 2

0

尝试:

var item = jQuery("[name='directorSequence']");
item.attr("aria-valuenow");

jsFiddle:http: //jsfiddle.net/hescano/KmnAA/

于 2013-09-10T22:01:37.503 回答
0

使用attr()方法。

$('input[name=directorSequence]').attr('aria-valuenow')

jQuery API

于 2013-09-10T22:02:03.820 回答