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!