0

I'm Using Jquery Ui Dialog and have problem setting text. I'm using this code to insert a link:

$('#dialog').text(<a href=\"#\" >Click Here</a>).dialog();

But it shows the code and tags instead of the link. How can I use tags there?

4 Answers 4

5

when you use text , you exactly tell the jquery ui core to treat that string as a text. You can simply use HTML like this :

$('#dialog').html('<a href="#" >Click Here</a>').dialog();
Sign up to request clarification or add additional context in comments.

Comments

0

try this:

$("<a href=\"#\" >Click Here</a>").appendTo('body').dialog();

Comments

0

The issue here is that you're using the text function, which is just for text as it escapes characters needed for valid HTML.

You should instead be using the html function, with it your working code would be:

$('#dialog').html("<a href=\"\">Click Here</a>").dialog();

Comments

0

Check http://jqueryui.com/dialog/ The place where the text appears is:

<div id="dialog" title="Basic dialog">
<p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>

And in the documentation (http://api.jqueryui.com/dialog/) there is no .text as function

Comments