我在jGrowl中使用Magento 1.7.0.2和jQuery 1.9.1。我试图实现的是获取用户的数量值,然后将其显示为右上角的jGrowl通知。 jGrowl只是使用$ .jGrowl(“My Text Here”)显示文本的一种方式;继承人我得到了什么至今:Magento/jQuery - 在用户点击后获取输入值
HTML
<div class="add-to-cart bottom">
<input type="text" name="qty" id="qty" maxlength="12" value="500" title="Qty" onclick="$.jGrowl('500 Added To Cart');" class="input-text qty">
<button type="button" title="Add to Cart" class="button btn-cart" onclick="productAddToCartForm.submit(this)"><span><span>Continue to cart</span></span></button>
</div>
jQuery的
$('input#qty.input-text.qty').bind("keydown change", function(event){
$.jGrowl(this.value);
});
它的工作原理,但我的notifcation显示3种不同的notifactions是用户类型,如果我在500的数量类型框中,它显示5,50和500单独通知,有没有办法让用户点击输入字段后显示?
在此先感谢
如果您在绑定中使用'keydown',则不需要'change'。 – Kalpesh 2013-04-29 17:48:01
试过了,这次它不显示任何东西。 – Gerardo 2013-04-29 20:36:18