関数の変数を送信する必要があるため、コード ビハインドから jQuery 関数を呼び出します。私はコードビハインドでこのコードを使用しました:
ClientScript.RegisterClientScriptBlock(this.GetType(), "myfunction", "ValidateTB("+ num+ "," + count +");", true);
そして私の機能は:
function ValidateTB(num,count) {
var check = false;
alert("alert");
for (var i = 0; i < num; i = i + 1) {
check = false;
for (var j = 0; j < count; j = j + 1) {
var id = "myTextBox" + i + j;
if ($("input[type='text']").val().length > 0) {
check = true;
}
if (check == false) {
$("#error").text("error");
return false;
}
}
}
return true;
};
機能が動作しないのはなぜですか? 私の機能が実行されていないようです