Karl Rudd schrieb:
What do you mean by required tag? Do you mean the attributes in the
tag/element, like src=pic1?
If you want the src attribute of the element you have selected you
could do this:
alert( $(#k img).get(i).attr('src') );
No, that will throw an error, because at this point:
Klaus Hartl schreef:
No, that will throw an error, because at this point: $(#k
img).get(i) you already have a reference to the DOM element itself.
Thus the following will work:
$(#k img).get(i).src
or stick to jQuery:
$(#k img).attr('src')
it's it $(#k img).eq(i).attr('src').
--
David
Yes you're both correct. I wrote things out too quickly.
Karl Rudd
On 4/10/07, David Duymelinck [EMAIL PROTECTED] wrote:
David Duymelinck schreef:
Klaus Hartl schreef:
No, that will throw an error, because at this point: $(#k
img).get(i) you already have a reference to the DOM element
Correct. Only Internet Explorer supports outerHTML. Even innerHTML
started off as a Microsoft only thing, but because it was used so
widely other browsers have adopted it as a defacto standard.
What are you trying to do that you need to use outerHTML?
Hi everyone in this thead, I was about
You could try this, it's a bit sloppy but what the heck...
$.fn.outerHtml = function() {
$this = $(this);
var h = $this.html();
var s = $this.wrap(div/div).parent().html();
$this.empty().html(h);
return s;
};
div id=A
div id=B
@googlegroups.com
Sent: Tuesday, April 10, 2007 6:15:50 AM
Subject: [jQuery] Re: outerHTML and Firefox does not work
You could try this, it's a bit sloppy but what the heck...
$.fn.outerHtml = function() {
$this = $(this);
var h = $this.html();
var s
outerHTML is an IE only property that only a few other browsers support.
However, Mozilla's JavaScript implementation rocks so try this code I
found on http://webfx.eae.net/dhtml/ieemu/htmlmodel.html:
var _emptyTags = {
IMG: true,
BR:true,
INPUT: true,
META: true,
LINK:
thanks a lot
as a jquery beginner I wonder if there is no jquery way to get the required
tag?
best regards
Bernd
--
View this message in context:
http://www.nabble.com/outerHTML-and-Firefox-does-not-work-tf3549488s15494.html#a9910093
Sent from the JQuery mailing list archive at Nabble.com.
What do you mean by required tag? Do you mean the attributes in the
tag/element, like src=pic1?
If you want the src attribute of the element you have selected you
could do this:
alert( $(#k img).get(i).attr('src') );
Or if you have more than one 'img' inside the '#k' div you could loop
9 matches
Mail list logo