[jQuery] Basic help needed jQuery
Hi everyone,
I'm not too sufficient in jQuery -- at all... But basically I'm trying
to take this code and give not only the title text it's own menu
(''popupInfo'), but also I want <img src="images/add.gif"> to have
it's own menu, of a different ID of course. I'm not familiar enough to
be able to separate these in this code. I've already separated the two
menus themselves in the other JS file that actually handles the
creation and execution of the menus, and their contents.
You can see the part toward the bottom that creates the popup menu.
The new popup menu needs to be able to carry the 'id' and 'title' for
the entry, or else the menu will be useless in what I do with it.
Snippet:
var ul = document.createElement('ul');
ul.setAttribute('id', 'list');
clearList('top_results');
for(i=0; i<items.length; i++) {
if( items[i] != null ) {
id = items[i]['id'];
title = items[i]['title'];
li = document.createElement("li");
div = document.createElement("div");
$(li).attr("id", id).addClass( "item" );
$(div).html( title );
$(div).addClass( "item-title" );
$(li).prepend( div );
$(div).prepend("<img src=images/add.gif
class=add> ");
$(div).flower({ click: popupInfo.searchResultHandler,
indicate: popupInfo.shelves,
image: "images/popup_main.png",
leave: popupInfo.leave,
clickstyle: "item-click"
});
$("#top_results").append(li);
}
So in the end I want both the html title class AND the .GIF file to
have separate div.popup actions, currently they both are clickable and
they both open up the same menu, I want it separate - of course I will
need to change "popupInfo.searchResultHandler," in other areas to
differentiate them..., but I'm just wanting this part done first, I
can handle the rest. :-)
Thanks