jQuery get the value of ahref and put it to button
Posted
by
user1506189
on Stack Overflow
See other posts from Stack Overflow
or by user1506189
Published on 2012-07-08T07:00:11Z
Indexed on
2012/07/08
9:15 UTC
Read the original article
Hit count: 200
i have this problem that i need to get the value of href and pass it to a button.
is this correct format of jQuery?
$(function() {
var getValue = $('#theLink').getAttributeNode('onclick').value;
$('.yt_holder').live('click', '.videoThumb4', function(){
$(".videoThumb4").ytplaylist({
holderId: 'ytvideo4',
html5: true,
playerWidth: '520',
autoPlay: false,
sliding: false,
listsliding: true,
social: true,
autoHide: false,
playfirst: 0,
playOnLoad: false,
modestbranding: true,
showInfo: false
});
});
});
the button was working but it only play the first video on his list. the link of the website is here http://cocopop12.site11.com/search/index.php
now the button is this.
<input class="videoThumb4" onClick="http://www.youtube.com/watch?v=' . $yValue['videoid'] . '" type="button" name="previewSel" value="Preview" id="previewbut" />
is that correct? that i need to do a onclick http://www....
blabla?
the <a href>
that i like to make a button is this.
<?php
echo '
<a class="videoThumb4" href="http://www.youtube.com/watch?v=' . $yValue['videoid'] . '" id="link">
' . $yValue['description'] . '
</a>
';
?>
how can i use .each for the button {Preview}? how can i put the value in the button just like --when i click this href it automatically play the video? but the button it just play the first video but not the second video. this i want to make it like a button.
thank you for your time.
© Stack Overflow or respective owner