Hello everyone,

I was looking for a code like to store iframe's id in javascript's variable inside different divs.

 <div id="player">

    <iframe id="SAR7KmiCHto"  width="560" height="315" src="http://www.youtube.com/embed/SAR7KmiCHto?enablejsapi=1" frameborder="0" allowfullscreen></iframe>

    <div id="player2">
    <iframe width="560" height="315" src="//www.youtube.com/embed/9P9JSgZwrjc" frameborder="0" allowfullscreen id="9P9JSgZwrjc"></iframe>

In above code there are two div ids i.e player and player2. Now I want to store id of iframe from player div in javascript/jquery variable. Need some suggestions.

                            Thanks in advance.

As i understand , you can find iframe. hope this help you.

                var test=$('#player').find('iframe').attr('id');
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.