Reputation:
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?
Upvotes: 0
Views: 2280
Reputation: 634
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
Upvotes: 0
Reputation: 1964
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();
Upvotes: 0
Reputation: 287
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();
Upvotes: 5
Reputation: 5545
try this:
$("<a href=\"#\" >Click Here</a>").appendTo('body').dialog();
Upvotes: 0