Hi I'm new here hopefully I can contribute as time goes on. I working on making a simple tag cloud for work and cant seem to get rid of the commas in my array.
here's the code:
When it prints out it goes as such: orange,banana,apple,HTML Code:<script type="text/javascript"> var s = document.getElementById("input").value; var punct_less = s.replace(/[\.,-\/#!$%\^&\*;:{}=\-_`~()]/g,""); var finalString = punct_less.replace(/\s{2,}/g,""); var split = new Array(); split = finalString.split(" "); split.sort(); var diff = unique(split); document.getElementById("display").innerHTML = diff; </script>
I tried a replace after the unique function that only displays non-duplicates but it doesn't seem to be working....any thoughts


Reply With Quote

Bookmarks