Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6729967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:21:09+00:00 2026-05-26T10:21:09+00:00

Using this jQuery: $(‘#mycarousel li img’).click(function(){ $(‘#video’).empty(); var newId = $(this).attr(‘id’); newId = newId.replace(‘vid’,”);

  • 0

Using this jQuery:

$('#mycarousel li img').click(function(){
    $('#video').empty();
    var newId = $(this).attr('id');
    newId = newId.replace('vid','');
    $('#video iframe').attr('src', $('.vidHolder' + newId).html());
});

And the relevant HTML:

<ul id="mycarousel" class="jcarousel-skin-tango"><li><img src="pathtoimage" id="vid1" width="90" height="55" alt="" /></li>

<div id="video"><iframe src="pathtocurrentiframe" style="overflow:hidden"  id="fr"  width="425" height="480" frameborder="0" hspace="0" vspace="0" style="overflow:hidden;"></iframe><div id="dialog" title="" style="width: 0; height: 0;"></div></div>

<div class="vidHolder1" style="display: none;">newpathtoiframe</div>

Now for some reason, when i click the img it just removes the iFrame! Not changing the src like i need it to…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T10:21:09+00:00Added an answer on May 26, 2026 at 10:21 am

    I’m guessing your problem is the first line of your click function:

    $('#video').empty();
    

    The .empty() method removes all child elements, which means it will remove your iframe.

    The last line in your function then does nothing because no elements match the selector (but you won’t get an error because jQuery is quite happy to do nothing when no elements match the selector).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm using this jquery script: $(document).ready(function(){ $(#basketItemsWrap li:first).hide(); $(.productPriceWrapRight a img).click(function() { var productIDValSplitter
Using this jquery code: <a href=javascript:void(0) id=m1>Get Selected id's</a> jQuery(#m1).click( function() { var s;
I'm using this: jQuery('.class1 a').click( function() { if ($(.class2).is(:hidden)) { $(.class2).slideDown(slow); } else {
I'm using this jQuery to hide a DIV: $(#slider).click(function() { $(.help).slideToggle(); $(#wrapper).animate({ opacity: 1.0
I have three forms and using this jquery function $('form').submit(function() { $.ajax({ type: $(this).attr('method'),
I'm using this jQuery selector: $(a[href*='#']).click(function(e) { e.preventDefault(); alert(#valueinhere) }); to select links that
I am using this jquery .ajax function to save comments on a form: var
I'm using this jQuery with this: //Table select $(#reports-table tr).click( function(e) { if($(e.target).is(.row-button-small)) return;
im using this jquery function to do a ajax query: $(#add).click(function() { val1 =
I am using this jquery function: $(function() { $(#refresh).click(function() { $(#category_dialog).load(<?php echo $category; ?>)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.