Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get Attribute of hidden (display:none) html element

How do I get the href attribute of a hidden element e.g.

<div style="display: none;">
<div id="inline1" style="width:640px; height: 363px; overflow:hidden;">
<a class="a.player" style="display: block; width: 640px; height: 360px; " href="http://myvideo.mp4"></a>
</div>
</div>

var videolink = $('a.player').attr('href');

alert (videolink);

This will give an undefined value, any help would be great.

like image 994
Psylant Avatar asked Nov 22 '25 10:11

Psylant


1 Answers

Your class name is flawed.

You should just name it player and then select it with a.player.

like image 123
Daniel A. White Avatar answered Nov 23 '25 23:11

Daniel A. White



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!