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 7173613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:51:40+00:00 2026-05-28T15:51:40+00:00

I am working on a YouTube web application that allows the user to use

  • 0

I am working on a YouTube web application that allows the user to use a sortable list to add links using an input field. Once the url passes a match function to check the url structure, the video ID is grabbed and placed in an Array under it’s own index.

var _videoList = new Array();

if (matchesReg)
    {
    var container = document.getElementById('sortable');
    var _videoId; 
    //grab the video ID from the URL
    _videoId = _videoUrl.replace(/^[^v]+v.(.{11}).*/,"$1");
    //place the Videoid in an array
    _videoList[_videoList.length] = _videoId;
    var new_element = document.createElement('li');
    //set the id of the li element to match it's position in the array
    new_element.id = _videoList.length;
    new_element.innerHTML = _videoUrl;
    container.insertBefore(new_element, container.firstChild);
    //diplay the vaild link message
    document.getElementById('msg').style.display="block";
    document.getElementById('msg').innerHTML = "Video URL added!";
    // Clean input field
    document.getElementById('newVideo').value="";
    } else {
    //failed to pass the regex test, diplay error
    document.getElementById('msg').style.display="block";
    document.getElementById('msg').innerHTML = "Error! Not a valid YouTube URL.";
    }

What I want to do it add a link to each new li element that will pass the video id to a cue function. How might I go about starting to achieve this?

  • 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-28T15:51:41+00:00Added an answer on May 28, 2026 at 3:51 pm

    Here is something to get you started:

    var refId = _videoList.length;
    var $new_element = $('li').attr('id', refId);
    var $link = $('a')
        .attr('href', _videoUrl)
        .innerHtml(_videoUrl)
        .data('refId', refId) // add parent li's id for reference in click event
        .appendTo( $new_element )
        .bind( 'click', function(){
            cue( $link.data('refId') );
            return false; // prevent browser's default click event
        });
    
    $new_element.appendTo( container );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on an application that needs to load flvs as well as YouTube
I'm working on a project that will use the .NET wrapper for the YouTube
Working in Eclipse on a Dynamic Web Project (using Tomcat (v5.5) as the app
Working with an Oracle 9i database from an ASP.NET 2.0 (VB) application using OLEDB.
I am working with a CMS for a web app in PHP, that has
i am working on a webapp for viewing youtube videos using chromeless and it
I'm working on a video sharing application that can load plugins that share to
I am working on an application for Windows Mobile 6 (or maybe 5) that
I'm working with Aptana 3 to build a PHP-based web app using phpfog. I
So in the project ive been working on i use the youtube API to

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.