i wan to retrive all the value of this code using class name ..is it possible in jquery . i want to retrive only the text within a div or number of div may be change the nex
Try this:
$(document).ready(function(){
var yourArray = [];
$("span.HOEnZb").find("div").each(function(){
if(($.trim($(this).text()).length>0)){
yourArray.push($(this).text());
}
});
});
DEMO
If you get the the text inside the element use
Text()
$(".element-classname").text();
In your code:
$('.HOEnZb').text();
if you want get all the data including html Tags use:
html()
$(".element-classname").html();
In your code:
$('.HOEnZb').html();
Hope it helps:)
Without jQuery:
textContent:
var text = document.querySelector('.someClassname').textContent;
Markup:
var text = document.querySelector('.someClassname').innerHTML;
Markup including the matched element:
var text = document.querySelector('.someClassname').outerHTML;
though outerHTML may not be supported by all browsers of interest and document.querySelector requires IE 8 or higher.