Please enable / Bitte aktiviere JavaScript!
Veuillez activer / Por favor activa el Javascript![ ? ]
How the data from the html separated by commas to convert to array? - bug-code.com Q&A

How the data from the html separated by commas to convert to array?

0 like 0 dislike
76 views
there is such a line in HTML:
text,65665,text,text,65665,56854


need js to pull the contents of that line and write to an array:
var array = [text,65665,text,text,65665,56854];
asked by | 76 views

2 Answers

0 like 0 dislike
const el = document.querySelector('#content') var array = el.textContent.split(',')
answered by
0 like 0 dislike
document.getElementById('content').textContent.split(',');
answered by
Welcome to Bug-code Q&A, where you can ask questions and receive answers from other members of the community.

24.8k questions

46.2k answers

0 comments

12.3k users

24,788 questions
46,220 answers
0 comments
12,337 users