Hello.
I add with data (). But I do not know how to calculate them.
for (...) { $(".list#" + n).data({ "title": "blabla", "fdfdfd": "dfdfd" }); }
How can I calculate how many records are in data () where title = blabla?
Thank.
Hello.
I add with data (). But I do not know how to calculate them.
for (...) { $(".list#" + n).data({ "title": "blabla", "fdfdfd": "dfdfd" }); }
How can I calculate how many records are in data () where title = blabla?
Thank.
... how many entries are in data () ...
I can disappoint you, but in data () there will be no records. This method sets / returns its own variables bound to objects. And what are you trying to do - I did not understand.
PS If you need to count objects that have a variable with a certain value set, then you can do it like this
var count = 0; for (i = 0; i < data.length; i++) { if (data[i].title == 'blabla') { count++; } } alert(count)
Source: https://ru.stackoverflow.com/questions/100584/
All Articles