Saturday, May 30, 2009

[jQuery] Re: jQuery $ alert....

change

$(txt).innerHtml

to either

$(txt).html()

or

$(txt)[0].innerHTML

The first calls the jQuery method .html() on a jQuery object. The second grabs the first element (a DOMElement) in the array-like jQuery object, and accesses its innerHTML property.

- Richard

On Sat, May 30, 2009 at 2:04 AM, Rams j <ramj.144@gmail.com> wrote:
Hi All

I am having the following div tag in body..

<div id="div01"><img src="lions/1.jpg" alt="flower" class="flower"/></div>

and my script as follows...
varX = 2;
varY = 3;
 var txt = '#div' + varX+ varY;
alert($(txt).innerHtml);

this is alerting like div23.innerHtml but this is not alerting the inner html of this div tag...

Help into this..

Thanks
Ramesh

No comments: