Reputation: 552
Trying to create a link dynamically for some purpose
$('', {
text: 'Click here!',
href: 'http://www.example.com',
title: 'Click to win'
}).appendTo('body');
But this is not working ... anything wrong ?
Upvotes: 2
Views: 47
Reputation: 31033
you have not selected the jquery option in the fiddle, also specify what are you creating <a/>
$(function(){
$('<a/>', {
text: 'Click here!',
href: 'http://www.example.com',
title: 'Click to win'
}).appendTo('body');
})
Upvotes: 1
Reputation: 76870
you should do:
$('<a/>', {
text: 'Click here!',
href: 'http://www.example.com',
title: 'Click to win'
}).appendTo('body');
Upvotes: 1
Reputation: 29983
You need the initial parameter to dynamically create your A link element:
$('<a/>', {
text: 'Click here!',
href: 'http://www.example.com',
title: 'Click to win'
}).appendTo('body');
Upvotes: 1