2013-08-27 83 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