HTML
<ul> <li>List 1</li> <li>List 2</li> <ul>
JQuery
$('ul li').text();
Current output
List1List2
Expected Result
List1,List2
Question
How to separate them with a comma?
Try using .map()along with .get()to get these texts into an array and .join()after that,
.map()
.get()
.join()
var values = $('#tags li').map(function(){ return $(this).text(); }).get().join(','); // List1,List2
Source: https://habr.com/ru/post/1544441/More articles:How to make sure that the child is valid while saving the parent? - ruby | fooobar.comКак мы можем наследовать протокол UITableViewDataSource в нашем классе? - ios8https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1544438/add-css-class-to-jeditable-input-field&usg=ALkJrhgyOu0H0A8KSdvXGe5lAtkdfZT2SQHeader, content and footer inside div with absolute position - htmlLooking for an SQL table that already contains wildcards? - sqlDrawing an empty rectangular shape in openGL - openglUpload videos to youtube using the YouTube data API. Broken Pipe (Errno :: EPIPE) - ruby | fooobar.comGHC FFI for windows: undefined reference to `CreateInstance @ 4 '- haskellChange Data Warehouse in Neo4j on Ubuntu - neo4jGrouped tablet with cutout axis - rAll Articles