I have a few checkboxes each with data atrribute data-route. On hover i alert first or any of the values i get only one letter ot symbol. Here is the code.
foreach ($this->coords as $index=>$value) {
echo '<label class="checkbox">
<input checked type="checkbox" id='.$i .'
data-route="[';
foreach ($value as $idroute){
echo '"Route' . $id . '",';
$id++;
}
echo ' ]" ';
echo "onclick='isChecked(this);'> " . $index;
echo "</label>";
$i++;
}
And the function for alert
$('.checkbox').bind('mouseenter', function() {
var Route = $('input', this).data('route');
alert(Route[1]);
});
What I am doing wrong ? Thanks !