[英]document.getElementById is not working in js
我有一張桌子:
<tr>
<td><input type="text" name="remaining_quantity" id="remaining_quantity" value="<?php if(isset($quantity)) echo $quantity; ?>"/></td>
<td><input type="text" name="remaining_price" id="remaining_price" value="<?php if(isset($price)) echo $price; ?>" /></td>
<input type="button" class="check fr ml" value="Check" id="check_equation" onclick="get_full_status()" />
</tr>
我想找到要輸入的值,所以,
function get_full_status(){
var remaining_quantity = document.getElementById('remaining_quantity').value;
var remaining_price = document.getElementById('remaining_price').value;
alert(remaining_quantity);alert(remaining_price);
}
我沒有得到實際價值。 如果你不明白問題,請問我。
我在jsfiddle上檢查了同樣的東西,它工作正常。 https://jsfiddle.net/b13gtff0/
function get_full_status(){
var remaining_quantity = document.getElementById('remaining_quantity').value;
var remaining_price = document.getElementById('remaining_price').value;
alert(remaining_quantity);alert(remaining_price);
}
我覺得這里的問題可能是服務器未返回任何值。 或者可能是一些php語法問題。 我的建議是您可以檢查服務器返回的響應。
當您在控制台中單擊按鈕時,還會看到任何異常。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.