Using the following code

jquery
var originalTitle=$("a.basic").attr("title");
                        $("div.area1").text(originalTitle);

html
<p>This is where the original title should go</p>
<div class="area1"></div>

I get the expected title attribute written into the 'div'.

However, if I swap the 'div' for a 'p'  the result is that the 'href'
is written into the paragraph instead of the title. Here is the
modified code that produces the unexpected result:

jquery
var originalTitle=$("a.basic").attr("title");
                        $("p.area1").text(originalTitle);

html
<p>This is where the original title should go</p>
<div class="area1"></div>


I suspect the problem is cockpit error but I wondered if there is some
restriction on this combination of jquery that requires a 'div' for
the area where the text is written.

Alternatively is someone can point out my error that would be much
appreciated.

Thanks.

Reply via email to