Skip to main content
added 1 characters in body
Source Link
Zoltan Toth
  • 47.8k
  • 12
  • 132
  • 138

I have a group of objects on my page. I want to get the first one, so I do this:

var tmpLi = li.first();
console.dir(tmpLi);

This works fine; it returns this in firebug:

enter image description here

I need to return the value of the outerHTML element, but can't seem to figure out how to get it. I've tried:

var tmpLi = li.first().data("outerHTML");

and

var tmpLi = li.first().attr("outerHTML");

var tmpLi = li.first().attr("outerHTML");

both of which return "undefined". Help?

I have a group of objects on my page. I want to get the first one, so I do this:

var tmpLi = li.first();
console.dir(tmpLi);

This works fine; it returns this in firebug:

enter image description here

I need to return the value of the outerHTML element, but can't seem to figure out how to get it. I've tried:

var tmpLi = li.first().data("outerHTML");

and

var tmpLi = li.first().attr("outerHTML");

both of which return "undefined". Help?

I have a group of objects on my page. I want to get the first one, so I do this:

var tmpLi = li.first();
console.dir(tmpLi);

This works fine; it returns this in firebug:

enter image description here

I need to return the value of the outerHTML element, but can't seem to figure out how to get it. I've tried:

var tmpLi = li.first().data("outerHTML");

and

var tmpLi = li.first().attr("outerHTML");

both of which return "undefined". Help?

Source Link
EmmyS
  • 12.2k
  • 49
  • 104
  • 161

How can I get the value of an object property in jquery?

I have a group of objects on my page. I want to get the first one, so I do this:

var tmpLi = li.first();
console.dir(tmpLi);

This works fine; it returns this in firebug:

enter image description here

I need to return the value of the outerHTML element, but can't seem to figure out how to get it. I've tried:

var tmpLi = li.first().data("outerHTML");

and

var tmpLi = li.first().attr("outerHTML");

both of which return "undefined". Help?