Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/434.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
javascript重置中的简单数字键盘_Javascript_Jquery - Fatal编程技术网

javascript重置中的简单数字键盘

javascript重置中的简单数字键盘,javascript,jquery,Javascript,Jquery,$('body')。在('click','num\u pad\u wrap div',函数()上{ 如果($('#车票号码')。text()='0'&&$('#车票号码')。text()!='C'){ $(“#票号”).empty(); } var pressed=($(this).find('span').text()='C')?$('#票证号').text('0'):$(this.find('span').text(); $(“#票号”)。追加(按); }); .num\u pad\u wr

$('body')。在('click','num\u pad\u wrap div',函数()上{
如果($('#车票号码')。text()='0'&&$('#车票号码')。text()!='C'){
$(“#票号”).empty();
}
var pressed=($(this).find('span').text()='C')?$('#票证号').text('0'):$(this.find('span').text();
$(“#票号”)。追加(按);
});
.num\u pad\u wrap div{
背景:黑色;
颜色:白色;
宽度:10px;
浮动:左;
右边距:10px;
填充:10px;
}

0
1.
2.
3.
4.
5.
6.
7.
8.
9
0
C

这就是你要找的吗

$('body').on('click', '.num_pad_wrap div', function() {

    if ($('#ticket_number').text() == '0' || $('#ticket_number').text() == '50') {
        $('#ticket_number').empty();
    }

    var pressed = ($(this).find('span').text() == 'C') ? $('#ticket_number').text('0') : $(this).find('span').text();

    $('#ticket_number').append(pressed);

    if ($('#ticket_number').text() > 50) {
        $('#ticket_number').text('50');
    }

});

这就是你要找的吗

$('body').on('click', '.num_pad_wrap div', function() {

    if ($('#ticket_number').text() == '0' || $('#ticket_number').text() == '50') {
        $('#ticket_number').empty();
    }

    var pressed = ($(this).find('span').text() == 'C') ? $('#ticket_number').text('0') : $(this).find('span').text();

    $('#ticket_number').append(pressed);

    if ($('#ticket_number').text() > 50) {
        $('#ticket_number').text('50');
    }

});

50是多少?长度还是值?@ParthTrivedi Value.Do
if(parseInt($(“#ticket_number”).val())>50{//Do stuff}
@ParthTrivedi没有那么简单,看看下面的答案,它不起作用。这是你现在的问题什么是50?长度还是值?@ParthTrivedi Value.Do
if(parseInt($(“#ticket_number”).val())>50{//Do stuff}
@ParthTrivedi没有那么简单,看看下面的答案,它不起作用。这里是您现在的问题我的错,代码块中缺少最后一个“});”。再试一次。糟糕,代码块中缺少最后一个“});”。再试一次。