Thursday, July 26, 2012

jquery hide div if youtube embed src is empty



Hi all I want is that a (container) div gets hidden (.videocontainer) when the src=\”\” and display when there is a link in the source. Hope someone can help out with this one


This is the code I\’m working on that obviously isn\’t working:



<script type=\"text/javascript\">
$(document).ready(function(){
if ($(\'iframe[src]\').text() === \"\")
$(\".videocontainer\").hide(

});
</script>
</head>
<body>
<div class=\"videocontainer\">
<div class=\"thevideo\">
<iframe width=\"310\" height=\"174\" src=\"http://www.youtube.com/embed/860PGF9GXZY\" frameborder=\"0\" allowfullscreen></iframe>
</div>
</div>
</body>






Rating: 5 out of 5 based on 3 ratings



The post jquery hide div if youtube embed src is empty appeared first on Javascript ASK.






via Javascript ASK http://javascriptask.phpfogapp.com/jquery-hide-div-if-youtube-embed-src-is-empty.html

No comments:

Post a Comment