So I have my HTML inside a jquery object and want to grab an element by class from that object, I have the following code:
var feed = data.post.content;
var $newFeed = $(feed);
var stuff = $newFeed('.ERSIngredients').html();
console.log(stuff);
When I print $newFeed itself I can see this div with this class exist, but I'm always getting an error: "Uncaught TypeError: object is not a function"
What am I doing wrong?
I think that you want:
var stuff = $newFeed.find('.ERSIngredients').html();
In other words, find a descendent of $newFeed
with the class ERSINgredients
and then get the html out of that.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.