1
我點擊一個按鈕後顯示一個警告框,但字符串文本正在關閉。爲什麼我的警報框不顯示正確的文本?
這是我的代碼:
jQuery('input[name="addtocart"]').each(function()
{
jQuery(this).on("click", function(event)
{
qty = jQuery(this).parent().find('input[name="qty"]').val();
var qty1 = parseFloat(qty);
qth = jQuery(this).parent().parent().find('.qtyonhand').text();
var qth1 = parseFloat(qth);
itemName = jQuery(this).parent().parent().parent().find('.cell-desc
span').text();
if(qty1 > qth1){
alert("For the following item, the ordered quantity exceeds the
current available quantity.Please adjust the quantity and
retry.\n"+itemName+"-"+"Available Qty:"+qth1);
}
});
});
這裏是圖像:
在上述圖像,可用性文本顯示在下一行。 如何在單行顯示字符串?請幫忙。
使用'... + itemName.trim() +「 - 」+「可用...' – adeneo
感謝它的工作正常 –