2013-08-27 82 views
0

我有像搜索属性值的CSV

<div id="hoslist" class="hBlock" data-accredation-list="" 
data-amenty-list="" data-room-list="1,2,3,4" data-loc-id="1"> 
每个数据属性的

的容器可以具有CSV,单或空值。我试图过滤那些在数据属性中具有匹配值的人。

<script> 
$(document).ready(function(){ 
roomid=1; 
var objlist=$("div[data-room-list]"); 
//this return all div[s] which have this attribute 
//but i am not able to proceed beyond this. 

}); 
</script> 

我怎样才能得到的数据属性的CSV值,

更新:

$(".hBlock").data('data-room-list') //this gives me undefined 

回答

1

$( “hBlock”)ATTR( '数据室清单'); //可能是解决方案

+0

多数民众赞成在很奇怪,这是如何工作的。建议的方法是[数据](http://stackoverflow.com/questions/8345666/on-select-change-get-data-attribute-value) – Andrew