javascript - how to find a property in multi element with same class? -
I need to find properties multi with the same class, and for this purpose I use a loop for this For example, for example:
for (var i = 0; i & lt; $ ('chat-to') length; ++ i) if ($ ('. Chat-to ') [i] Sahara (' id ') == receiver id) return; But if the statement throws in run time, then unicet type error: there is no undefined function However, when I check it in the console with this code < Code> $ ('chat-to') [i] This shows the whole tag, I should know why? Thank you.
$ ('chat-to') [i] DOM element Gives no jQuery object you need to use .eq () to fetch jQuery objects. For
(var i = 0; i & lt; $ ('chat-to') .length; ++ i) if ($ ('chat-to'). Eq (I) .prop ('id') == receiver id) return; Or, you can use the scheme DOM to get the ID: for (var i = 0; i
Comments
Post a Comment