Home > Web Front-end > JS Tutorial > Detailed example of how to get an object from the object list

Detailed example of how to get an object from the object list

小云云
Release: 2018-02-05 13:40:34
Original
2270 people have browsed it

This article mainly brings you a method to obtain an object from the object list, based on keywords and values. The editor thinks it is quite good, so I will share it with you now and give it as a reference for everyone. Let’s follow the editor to take a look, I hope it can help everyone.

As shown below:

function getobj(objs, key, value) {
for (var i in objs) {
var obj = $(objs[i]);
if (obj.attr(key) == value) {
return obj[0];
}
}
return null;
};
Copy after login

Related recommendations:

How to obtain objects and copy objects using javascript Detailed explanation of usage

How to get the attribute name of the object in php

About Jquery to get the attribute and value of the object

The above is the detailed content of Detailed example of how to get an object from the object list. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template