H
H
Heretic Man2018-11-16 23:20:37
JavaScript
Heretic Man, 2018-11-16 23:20:37

How to convert comma delimited html data to array?

There is this line in HTML:

<div id="content">текст,65665,текст,текст,65665,56854</div>

you need to pull out the contents of this line in js and write it as an array:
var array = [текст,65665,текст,текст,65665,56854];

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stalker_RED, 2018-11-16
@heretic_man

const el = document.querySelector('#content')
var array = el.textContent.split(',')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question