-1

Hello I need get value of data-plus attribute with Jquery See example

[http://jsfiddle.net/24zr4ww5/][1]

I can calculate sum of all inputs, and I need get sum of data-plus all inputs, where value > 0

Pekkonen
  • 38
  • 6
  • You should iterate your buttons with $.each var buttons = $('.button'); var sum=0; $.each(buttons, function (index, item) { if ($(item).data('plus')>0) sum+=$(item).data('plus'); }); – Carlos Alves Jorge Aug 30 '17 at 16:13
  • Could you explain which button you mean? I don't understand your idea, sorry. Or add your code in my example. – Pekkonen Aug 30 '17 at 21:54

1 Answers1

0

Kindly use below way to get data value, this is the way to get data attribute

var value = $(this).data('field');
amit wadhwani
  • 1,140
  • 1
  • 7
  • 12