html Filtra Array Multiplo jQuery
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html Filtra Array Multiplo jQuery相关的知识,希望对你有一定的参考价值。
$(function(){
var items = [
{ id: 01, categoria: "Sport", posizione: "Esterno", metri1 : 2, metri2: 1, prezzo: "€3.888,00"},
{ id: 02, categoria: "Sport", posizione: "Esterno", metri1 : 2, metri2: 2, prezzo: "€6.738,00"},
{ id: 03, categoria: "Sport", posizione: "Esterno", metri1 : 2, metri2: 3, prezzo: "€9.576,00"}
];
var filteredItems = $(items).filter(function( idx ) {
return items[idx].categoria == "Sport" && items[idx].posizione == "Esterno" && items[idx].metri1 == 2 && items[idx].metri2 == 2;
});
$(filteredItems).each(function(){
$('#output').append(this.id+" : "+this.prezzo+"<br>");
});
});
<!DOCTYPE html>
<html lang="it" dir="ltr">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Titolo del Progetto</title>
<meta name="description" content="Descrizione Meta">
<link rel="profile" href="http://gmpg.org/xfn/11">
<script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
<script src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script type="text/javascript" src="filter.js"></script>
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div id="output"></div>
</body>
</html>
以上是关于html Filtra Array Multiplo jQuery的主要内容,如果未能解决你的问题,请参考以下文章
Python学习--[进阶]函数
以下代码如何在IE8中用于上传多个文件?
如何使用复选框和单选值构建 URL?
移动父视图时出现约束错误
如何在递增 Swift 后赋值?
html array.html