I have the following code
function functionCLick(name) {
$.getJSON('livros.json', function(data){
$.each(data, function(i, item){
if(item.name == name){
$("#conteudo").html("<p>"+item.chapters+"</p>");
}
});
});
}
follows a part of json
[
{
"abbrev": "hob",
"chapters": [
[
"exemplo1.",
"exemplo2.",
"exemplo3."
],
[
"exemplo4.",
"exemplo5.",
"exemplo6."
]
],
"name": "hoobit"
},
]
My question is the following I wanted to know if there is a way to format the output. My output in the browser is as follows, it inserts in the html all the content that is in chapters including it also shows the commas of json example line: example1., example2., example3., example4., example5., example6. it returns the commas that are at the end of each line of json's chapters . I thought of removing all the commas with the jquery but thinking, in the text there may be some comma that can not be removed. And another doubt about breaking the chapters