I'm trying to get data from multiple divs sharing the same id using jquery, However every time I get just the first div data.
Code:
$(document).ready(function(){
if($('[id="title"]').length > 0){
console.log($('[id="title"]').html());
}
});
<div id="title">Title one.</div>
<div id="title">Title two.</div>
<div id="title">Title three.</div>
<div id="title">Title four.</div>
The result that I get is: Title one.
I'm expecting to get: Title one. Title two. Title three. Title four.
Any solution would be very appreciated.