I am learning JQuery and I am having trouble trying to write code which outputs a comma separated list in a CSV format from HTML code. I am trying to put the the titles of the images in a comma separated list.
Here is the HTML I am using:
<html>
<head>
</head>
<body>
<img src="/images/title.jpg" title="TITLE IMAGE" />
<div id="brand-container">
<div class="xyz">
<img src="/images/brand1.jpg" title="Adidas" />
<img src="/images/brand2.jpg" title="Dr Martens" />
<img src="/images/brand3.jpg" title="Fred Perry" />
<img src="/images/brand4.jpg" title="Lacoste" />
</div>
</div>
<div class="xyz">
<img src="/images/other.jpg" title="OTHER IMAGE" />
</div>
</body>
</html>
The following JQuery code is what I have tried to use.
var title = $(':').map(function() {
return this.value;
}).get().join(',');