tags:

views:

115

answers:

6

I couldn't find this anywhere, partly because it's keywords are pretty common. Can somebody help me with this pretty simple question?

$('.pause_button').text('<img src="../imgs/icons/control_pause_blue.png" alt="Resume" /> Resume');

I want it to print this as html and not convert the brackets and apostrophes? Thanks!

+11  A: 

Make us of .html function avaialble in jquery

.html()

for example :

$('div.demo-container').html('<p>All new content. <em>You bet!</em></p>');

in your case

$('.pause_button').html('<img src="../imgs/icons/control_pause_blue.png" 
alt="Resume" /> Resume');
Pranay Rana
+5  A: 

Use .html()

$('.pause_button').html('<img src="../imgs/icons/control_pause_blue.png" alt="Resume" /> Resume'); 
Marimuthu Madasamy
+3  A: 

use .html() instead of text

Haim Evgi
+3  A: 

You should use .html();.

lfx
+5  A: 

use .html()

$('.pause_button').html('<img src="../imgs/icons/control_pause_blue.png" alt="Resume" /> Resume');
jAndy
+3  A: 

.test() actualy escapes all html spesific chars, .html() don't

muxare