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

  • Home
  • SEARCH
  • 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 1054231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:22:23+00:00 2026-05-16T17:22:23+00:00

Is it possible using jQuery to select one full link which href contains another

  • 0

Is it possible using jQuery to select one full link which href contains another variable?

My code is:

var element1 = $(".not-viewed").parents('li').attr("id");

var element2 = $(".videoTitle").attr("href");

Where i need to select a full link that contains ‘element1’,because there several videos in the page.In my code select the first on the page,but i need the specific with id..
Example..[In this example the code that i need is: 1581889025]

    <li class="videoContainer vidLink" id="1581889025">
    <a href="site.com../view/1581889025:49_3eA8F7sPr5FQGZcl2yzx3dz5Y_XwP">
    <span class="HOVER"></span>
    <div class="videoX"><img id="clThumb_1581889025" src="PREVIEW.jpg">
    </div>  </a>
    <a class="videoTitle" href="site.com../view/1581889025:49_3eA8F7sPr5FQGZcl2yzx3dz5Y_XwP">Title of Video</a>
<span class='not-viewed'></span>
<div class="tooltip-footer"></div>
</li>

Thanks in advance.
Kind regards.

  • 1 1 Answer
  • 1 View
  • 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-16T17:22:23+00:00Added an answer on May 16, 2026 at 5:22 pm

    You can use the attribute-contains selector (*=), like this:

    var id = $(".not-viewed").parents('li').attr("id");
    var href = $(".videoTitle[href*='" + id + "']").attr("href");
    

    You can give it a try here, you may also want $(".videoTitle[href*='/" + id + ":']") to narrow it down to /1581889025: matches, in case there was a 15818890250 for example.

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

Sidebar

Related Questions

Is it possible using jQuery to select all <a> links which href ends with
Is it possible using jQuery to verify if the following HTML select list contains
Is it possible to select DISTINCT values using Rails3 JQuery autocomplete gem?
Using the jQuery UI Tabs component, is it possible to select new tabs on
Possible Duplicate: Hide select option in IE using jQuery So as you can see
I am using JQuery autocomplete in one of our web pages which gets source
is it possible using jQuery and CSS to split a div in two, and
Is it possible when using jQuery's $.serialize() or $.serializeArray() to get the types of
What is the best possible way using jQuery to give height and width to
Possible Duplicate: Find text string using jQuery? How do you find a text string

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.