The function below doesn't seem to work and I can't tell if my query is wrong or my php. $num_rows
returns a value of 3
in a previous php script on the same page.
$('.markTD').click(function () {
var qnum = $(this).attr('value');
if (qnum != 1 || qnum != <?php echo $num_rows ?> ) {
$('#submit').css("display", "none");
$('#next').css("display", "block");
$('#prev').css("display", "block");
}
});
答案 0 :(得分:0)
You should convert the input value from string to number, like below.
Oh, and use .val()
function instead of .attr('value')
:)
$('.markTD').click(function () {
var qnum = parseInt($(this).val() || 0, 10);
if (qnum != 1 || qnum != <?php echo $num_rows ?> ) {
$('#submit').css("display", "none");
$('#next').css("display", "block");
$('#prev').css("display", "block");
}
});