문제

This is jQuery code while button click the for loop is not working in dialog div submit date button please some one help me friends. . .

$("#dialog-form").dialog({
    autoOpen: false,
    height: 300,
    width: 350,
    modal: true,
    buttons: {
        "Submit Date": function () {
            for (var j = 1; j <= MGDval; j++) {
                alert($('S' + j).val());
            }
            $(this).dialog("close");
        },
        Cancel: function () {
            $(this).dialog("close");
        }
    },
    close: function () {
        $(this).dialog("close");
    }
});
도움이 되었습니까?

해결책

alert($('S'+j).val());

change to :

alert($('#S'+j).val()); // => for ID

alert($('.S'+j).val()); // => for Class

if selector element "S" : "#S" or ".S"

다른 팁

s does nor refer to any thing chnage to .s for class or #s for Id

alert($('#S'+j).val());

alert($('.S'+j).val());
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top