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

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

小云云
小云云Original
2018-02-05 13:40:342196browse

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;
};

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!

Statement:
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