I have been working on an issue which made me confused.
I'm new to java script. I have been trying to add a URL to an anchor href using appendTo
and click()
function in jquery.
This is my HTML code:
<a id="player"></a>
<a id="play-this-video" class="play-video" href="#" linkdata='href="http://site.com/file.flv"'></a>
and this is the jquery code I am using:
<script>
$("a#play-this-video").click(function() {
var linkdata = $(this).attr('linkdata');
$(linkdata).appendTo('a#player');
});
</script>
But it doesn't work! Am I right or something is wrong?!