Use DHTML property. $("table:first")[0].outerHTML
On Aug 19, 12:36 am, John <jian.fang.subscr...@gmail.com> wrote: > Thanks, Anurag. Let me rephrase my question. For example, I can use > the following jQuery > to get the html source of a table element > > $("table:first").html() > > The returned html source does not include the table itself, I like to > see the html source starting > from the table, for example, > > <table class="aaa"> > ...... > </table> > > Is there any jQuery function for this? If not, how do I implement > this? > > Thanks in advance, > > John > On Aug 18, 2:06 am, anurag pal <mail.anurag....@gmail.com> wrote: > > > Hi John, > > > After setting the html by using html method you have to bind the DOM > > elements using bind method. > > > Example: > > <script type="text/javascript"> > > $(".pge").bind("click", function(e){ > > var options = {}; > > $.ajax({ > > url: "data_retrieval.php", > > cache: false, > > type: "GET", > > data: ({id : this.getAttribute('id')}), > > > success: function(html){ > > $("#slacker_detail_view").html(html); > > $('#slacker_detail_view').show('blind', options, > > 1500); > > } > > }); > > }); > > </script> > > > Regards, > > Anurag Pal > > > On Tue, Aug 18, 2009 at 7:40 AM, John <jian.fang.subscr...@gmail.com> wrote: > > > > Hi, > > > > How do I get back the DOM element as HTML source using jQuery? The html > > > () method only returns the innerHTML and it does not include the UI > > > element itself. But I am more interested in converting the UI element > > > itself to HTML. > > > > Thanks in advance, > > > > Jian