JQuery AppendTo Title attribute -


i'm following tutorial drag drop inventory in jquery

and i'm having problem. in demo accompanies tutorial, author uses code :

item.attr('src',drag_item.attr('src')).attr('class',drag_item.attr('class')).appendto(spot).draggable({ revert: 'invalid' }); 

while works great in recreating img element, not copy title attribute( want copy because it's important tooltips).

i've changed code :

item.attr('title',drag_item.attr('title')).attr('src',drag_item.attr('src')).attr('class',drag_item.attr('class')).appendto(spot).draggable({ revert: 'invalid' }); 

which should work think, not. when change drag_item.attr('title') static "hello", works, attr func not return title.

my html :

<div id="inventory" style="width:300px; height:150px; margin:10px; padding:15px; border:1px solid black; display:block; clear:both;">  <% @inv_items.each |i| %>    <% w = weapon.find_by_id(i.item_id) %>        <img class='weapons' src= "/images/weapons/<%=h w.imagename %>" title="<%= setweapontitlefortooltip(w, i) %>" />  <% end %> </div> 

the html erb template. have idea why happens ?

yours code seems fine. working demo i.e. derived example given in above link. copying title attribute.


Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -