I am trying to get array value from data tag to jQuery but not working. Here is my code:
//$b is taking names from text-area separated by comma.
$a = array_map('trim', explode(",", $b));
return <input type="text" id="pct"><button id="pcthit">submit</button><p id="pct_avail"></p></span>
<input type="hidden" id="storageElement" data-storeIt="'.$a.'">';
$("#pcthit").click(function(){
var pstcde = $("#pct").val();
var retrieved_string = [];
var retrieved_string = $("#storageElement").data('storeit');
if((pstcde != '') && (jQuery.inArray(pstcde, retrieved_string) >= 0 )){
$("#pct_avail").html('hello');
}
});