Reputation: 17383
I have a lot of inputs like this :
<input cat-id="13" cart-id="11" coupon-property_id="0" pay-user="7800" off="61" price="20000" coupon-id="16669" max-buy="100" name="cart-quantity" class="cart-quantity info-coupon" value="1" disabled="" type="text">
that them have different values .
now, I have two question :
how can i get cat-id
value by using jquery ?
function removeInCart(id){
var cart_id = $('.cart-quantity .info-coupon').filter('input[cart-id='+id+']').attr();
}
it returns a jquery error.
cart-id,cat-id coupon-propery_id ...
in input element ? or I should use data-cart-id,data-cat-id ...
?Upvotes: 1
Views: 47
Reputation: 28513
Try this :remove space between .cart-quantity
and .info-coupon
and put attribute name in attr()
function
var cart_id = $('.cart-quantity.info-coupon').filter('input[cart-id='+id+']').attr('cat-id');
Upvotes: 1