Click here to Skip to main content
15,892,059 members
Articles / Web Development / HTML

jQuery selection div html() by click something in div.

Rate me:
Please Sign up or sign in to vote.
3.00/5 (1 vote)
15 Nov 2012CPOL 0  
You can try this$('.remove').live('click', function() { var postHTML =$(this).parent('.post').html();});Thanks,Jyotish

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

Please Sign up or sign in to vote.
18 Nov 2012deepak.m.shrma
$('.remove').click(function () {var postHTML = $(this).closest(".post").html(); // select closest div or element with class post });try this. its working fine.
Please Sign up or sign in to vote.
15 Nov 2012Lubomur 4 alternatives  
Hi, how can I select "post" div html() by click "remove".If I write $('post').html() select work only for first "post", but I need to select for example second or third.//html Some text for first div <a...
Please Sign up or sign in to vote.
16 Nov 2012Lubomur
var post = $(this).parents().parents().html();
Please Sign up or sign in to vote.
15 Nov 2012Ravi Tuvar
$('.remove').live('click', function () { $('.post:eq(1)').html(''); });Please try this this will give you the last div with class = post

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions