The jQuery selector is returning a special jQuery object which contains the actual DOM element inside it.
If you did this: var f=$('#testiframe'); alert(f[0]); you would get [object HTMLIFrameELement] The f variable would have a number of jQuery specific properties and methods that allow you to manipulate it. Such as: f.hide(); f.show(); f.append('<more html>'); JK -----Original Message----- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Geuis Sent: Thursday, September 18, 2008 1:53 PM To: jQuery (English) Subject: [jQuery] Why is getElementById different from $('testid')? So I have this code to write a content to an iframe which works just fine. I'm trying to rewrite it using Jquery though. var f=document.getElementById('testiframe'); var doc = f.contentWindow ? f.contentWindow.document : f.contentDocument ? f.contentDocument : f.document; doc.open(); doc.write(scriptvar); doc.close(); In testing, I'm finding that these are different: 1) var f=document.getElementById('testiframe'); 2) var f=$('#testiframe'); So #1 gives [object HTMLIFrameElement] if I alert(). #2 gives [object Object]. What is the difference between these two?