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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T18:53:14+00:00 2026-06-05T18:53:14+00:00

I am looking to use jquery to search for a certain string that gets

  • 0

I am looking to use jquery to search for a certain string that gets tagged onto the end of the page url after a user submits a form.

The url looks like

https://somerandomsite.com/?page_id=1423#wpcf7-f1448-p1423-o1

The only part of the string that stays consistent is the “wpcf7” so I am looking to target that with jquery and if it finds it run some code. Maybe use window.location.pathname somehow.

Any help would be much appreciated.

============================================

I got it everyone, thanks for your help. I don’t think I was very clear in explaining the problem so I apologize.

if(document.location.hash.substr(1,5) === 'wpcf7'){
$('#formalert').css('display', 'block');
  • 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-06-05T18:53:16+00:00Added an answer on June 5, 2026 at 6:53 pm

    That part is called the hash and is referenced as:

    location.hash
    

    This includes the # character itself, so you have to skip that:

    location.hash.substr(1)
    

    To get the first part behind it:

    location.hash.substr(1).split('-')[0]
    

    Update

    The final condition would be this:

    if (document.location.hash.substr(1).split('-')[0] === 'wpcf7') {
        // do whatever
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking for a way to use jQuery with a script index.php that is
I have a set of search filters that set a URL string (for further
I am looking for a nice quick live search/filter. Anybody use this? http://rikrikrik.com/jquery/quicksearch/#usage Also
I'm looking for a complete, step-by-step example of how to use jQuery Mobile 's
I am looking to implement a grid system. I already use jQuery, jQuery UI
Looking to pass variables from c# to javascript to use some jquery code. Passing
I am looking for a good jQuery pagination plugin to use in my aspx
I have a group of 4 divs and I'm looking to use jQuery to
I just started looking into the use of jQuery UI. What I would like
I'm looking for a jQuery plugin that wobbles DOM elements like on http://www.iconatlas.com/ I

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.