Hello!
How do i assign this newly created link to the local variable?
tblOutput += '<td>';
tblOutput += $('<a></a>')
.click(function (e) {
$.fancybox({ 'autoDimension': true, 'showCloseButton': true, 'type': 'iframe', 'href': 'WordManagerForm.aspx?cmd=updateword&categoryNodeID=' + nodeID + '&nodeID=' + id_text });
e.preventDefault();
})
.css('color', 'Blue')
.text(name_text);
tblOutput += '</td>';
I have tried applying .html()
after .text(name_text)
but that only prints the text out and not the active link. How can i get the link to work? After i have gone thru the loop i add the variable tblOutput to a div using $('#divOut').html(tblOutput);
It worked when i assigned it to an element with an id, like <div id="test"...>
and then .text(name_text).appendTo('#test');
.
Full loop:
$(xml).find('word').each(function () {
var id_text = $(this).attr('id');
var name_text = $(this).attr('name');
var translation_text = $(this).attr('translation');
$('<a></a>')
.click(function (e) {
$.fancybox({ 'autoDimension': true, 'showCloseButton': true, 'type': 'iframe', 'href': 'WordManagerForm.aspx?cmd=updateword&categoryNodeID=' + nodeID + '&nodeID=' + id_text });
e.preventDefault();
})
.css('color', 'Blue')
.text(name_text)
.appendTo('#bottomRight');
$('<br>').appendTo('#bottomRight');
});