I have a WCM
HTML
component, and the value stored inside [AttributeResource attributeName="myKey" separator=","]
is a comma separated String
.
When rendered on its own, I get the following output on my HTML
page ..
8,9,10,10.5,11,11.5,12,13
However, when I try to split it on ,
, it only gives me the first element i.e 8
How can I split this properly?
<script>
var keySplit = String([AttributeResource attributeName="myKey" separator=","]).split(',');
alert(keySplit);
</script>
Used a hidden
input
element to temporarily store values ..
<input type="hidden" id="myKeyTemp" value="[AttributeResource attributeName="myKey" separator=","]" />
<script>
var arrayOfValues = document.getElementById("myKeyTemp").value.split(',');
</script>