Say I have a formatted string str written in my backend java code like this :
name : xxx company : qwe
address : yyy age : asd
country : zzz
now I managed to display it on the browser console via
console.log(str);
and when I checked it is also formatted just the way it is
name : xxx company : qwe
address : yyy age : asd
country : zzz
but when I use Jquery to show it in a div in my html file, say for example
$('.divclass').text(str);
it will just be one line
name : xxx company : qweaddress : yyy age : asdcountry : zzz
this is all expected, but I was wondering if there is an implementation where I could possibly display the console.log to my html tag and still keep the format that I had before, instead of having to format it again, I guess my question is if there is a way to present console.log to the html in my case.
<pre>preformatted text i.e.$('.divclass').html('<pre>' + str + '</pre>');