单击按钮后,我显示了一个警告框,但字符串文本正在下降。
这是我的代码:
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);
}
});
});
这是图片:
在上图中,可用性文本显示在下一行。 如何在一行中显示字符串?请帮忙。
最佳答案
关于javascript - 为什么我的警报框没有显示正确的文本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39851138/