thanks, u actually helped me, but there's one point now, the image appears but doesn't load... ( i've figured from imagebox that it's better to work through rel attribute... so i've made a bind function on load $('a').each( function() { ok = $(this); href = ok.attr('rel')||''; ok.bind('click', function(){ $(".preview").html('<img width="600" height="400" src="'+href +'">'); }); } ); primitive, but works, except that the large picture doesn't show... help to figure it out please p.s.: it's a disaster that the main jquery site is not working, donated some money to help the community...
On May 6, 10:45 pm, joomlafreak <[EMAIL PROTECTED]> wrote: > On May 6, 12:38 am, Equand <[EMAIL PROTECTED]> wrote: > > > hi all, > > i'm a newbie in javascript and jquery also. > > could you please help > > i'm trying to write a function to do onclick of a div called img to > > change img in div called 'preview' > > how do i make it replace with an image which is taken from <a href=""> > > attribute of the img div? > > $(".img").click(function(){ > > $(".preview img").stopAll().before('').remove(); > > I am sorry to say but you are little ambiguous in what you wanna do. I > assume you are trying to replace an image in a div by clicking on > another div and the image you are placing is defined in a link??? > > If this is what you want mey be this can help > > $("#img").click(function(){ > var newimg = $(a.some_class).attr("href"); > $("#preview").html('<img src="'+newimg+'">'); > > }); > > I may have understood your question very well. Hope it helps.