2 Replies - 2040 Views - Last Post: 30 April 2011 - 08:11 AM

#1 heady89   User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 164
  • Joined: 31-December 09

jquery innerhtml?

Posted 30 April 2011 - 07:34 AM

Hi,

I'm trying to print some html code via jquery and i'm not sure im doing it the right way.
The code turns out as unformatted/unread html with tags etc with &lt , &gt signs instead of actual tags.

$("#mainContent").text(response);


$.post('Ajax.php', {}, lpOnComplete, 'html');


I suppose my question is how do i get the equivalent of .innerHTML in jquery?

This post has been edited by heady89: 30 April 2011 - 07:36 AM


Is This A Good Question/Topic? 0
  • +

Replies To: jquery innerhtml?

#2 Martyr2   User is offline

  • Programming Theoretician
  • member icon

Reputation: 5612
  • View blog
  • Posts: 14,686
  • Joined: 18-April 07

Re: jquery innerhtml?

Posted 30 April 2011 - 08:01 AM

Look at the .html() method...

$("div").html("<span style='font-weight: bold;'>HTML stylized text</span>");



This sets the HTML of a given element. :)

This post has been edited by Martyr2: 30 April 2011 - 08:02 AM

Was This Post Helpful? 1
  • +
  • -

#3 heady89   User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 164
  • Joined: 31-December 09

Re: jquery innerhtml?

Posted 30 April 2011 - 08:11 AM

thanks mate
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1