如何在JavaScript中仅隐藏文本值(How to hide only text value in JavaScript)
我在JavaScript和Html代码中有一些代码这很好(?)但问题是文本框也消失了。 有人可以帮忙吗?
function getProductBarcode() { var barcode = $('#productBarcode').val(); document.getElementById('#pos-RightTitle').style.display = 'block'; $.post('functions/pos-calculation-process.php', {barcode:barcode}) .done(function(data){ $('#pos-RightTitle').html(data); setTimeout(function(){ $('#productBarcode').hide(); }, 300) }); return false; }<div class="input-group"> <span class="input-group-addon"> <span class="glyphicon glyphicon-shopping-cart" aria-hidden="true"></span> </span> <input type="text" class="form-control" id="productBarcode"onchange = "getProductBarcode()" placeholder="Scan Barcode" aria-describedby="basic-addon1"> </div>I have some code in JavaScript and Html codes This works fine(?) but the problem is textbox also disappeared. Can anyone help?
function getProductBarcode() { var barcode = $('#productBarcode').val(); document.getElementById('#pos-RightTitle').style.display = 'block'; $.post('functions/pos-calculation-process.php', {barcode:barcode}) .done(function(data){ $('#pos-RightTitle').html(data); setTimeout(function(){ $('#productBarcode').hide(); }, 300) }); return false; }<div class="input-group"> <span class="input-group-addon"> <span class="glyphicon glyphicon-shopping-cart" aria-hidden="true"></span> </span> <input type="text" class="form-control" id="productBarcode"onchange = "getProductBarcode()" placeholder="Scan Barcode" aria-describedby="basic-addon1"> </div>最满意答案
如果您只想清除文本表单输入,请在setTimeout函数中替换此代码:
$('#productBarcode').hide();
有:
$('#productBarcode').val('');If you only want to clear the text form input replace this code in setTimeout function:
$('#productBarcode').hide();
with:
$('#productBarcode').val('');
更多推荐
function,class,getProductBarcode,电脑培训,计算机培训,IT培训"/> <meta name=&q
发布评论