0

Here's my relevant HTML:

       <div id="activity-menu">
          <h2><a id="activity-link-reddittv" href="#" data-url="https://app.herokuapp.com/reddit-tv/reddittv.html">Watch RedditTV</a></h2>
          <h2><a id="activity-link-topics" href="#">Topics</a></h2>
       </div>

       <div id="topics" style="display:none;" >
       </div> 

       <div id="#reddit-tv-div" style="display:none;" >
          <iframe id="reddit-tv-iframe" style="height:100%;width:100%;" style="border:none;"></iframe> 
       </div>

And here's my JQuery:

  $('#activity-link-reddittv').click(function(){

                var el = $(this);

                $('#activity-menu').hide();
                $('#reddit-tv-div').show();
                $('#reddit-tv-frame').attr('src', el.data('url'));

                console.log('el = ' + el); 
                console.log('el.url = ' + el.data('url')); 
                console.log('src = ' + $('#reddit-tv-frame').attr('src')); 

              });

Here's my logs:

el = [object Object] 
el.url = https://app.herokuapp.com/reddit-tv/reddittv.html
src = undefined 

The iframe doesn't show up, and based on the logs src never gets set.

This question has been answered numerous times on SO - one example. My code seems to follow these answers pero no funciona.

2
  • you have inconsistency between id in html and as jQuery selector. reddit-tv-iframe vs reddit-tv-frame Commented Jul 11, 2014 at 21:32
  • You have a typo, you're missing the i before frame in $('#reddit-tv-frame'). Commented Jul 11, 2014 at 21:33

1 Answer 1

0

i is missing in "#reddit-tv-frame". Correct the spelling.

$('#reddit-tv-iframe').attr('src', el.data('url'));
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.