jquery: why won't it work with more than one var?
I'm trying to pull some elements and rewrite the html using jquery. It works if I just do it with one variable, but when I try to add more than one, it returns [object][Object].... What's wrong?
-
$j('#hp-featured-item > div[id^="post-"]').each(function() {
var id=this.id.match(/post-(\d+)/);
var imgt = $j("img:eq(0)");
var pt = $j("p:eq(0)");
var hh = $j("h2:eq(0)");
// If I do just one element, it will correctly print out the img
$j(this).html(imgt);
// If I do this, it prints out [object][Object]
$j(this).html(imgt+hh+pt);