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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:12:55+00:00 2026-06-11T14:12:55+00:00

I have a problem with a button that I want it to redirect to

  • 0

I have a problem with a button that I want it to redirect to another page, I used the location.href but it didn’t work also I’ve used the jQuery method $(location).attr('href','url') and nothing happend either to make it more clear
the button goes like this:
<input type="button" value="New Project" onclick="createDiscoveryProject()"/>
where the method createDiscoveryProject is like this:
function createDiscoveryProject(){$(location).attr('href',[@spring.url '/myPage'])}

now when I click on the button nothing happen even when I ‘ve added alert method inside the createDiscoveryProject no alert pops, finally I want to add that the JavaScript method is in the template ftl file while the button is in another ftl file. any help?

  • 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-11T14:12:56+00:00Added an answer on June 11, 2026 at 2:12 pm

    Since you are already using jQuery why don’t you bind the function on document ready to the button. Don’t get me wrong, the way you’re doing is should totally work, but since you are saying that even an alert isn’t working there might be another js error in your code so maybe this way you will work around it.

    So:

    $(document).ready(function(){
       $("button").click(function(){
          window.location.href = "http://domain.tld";
       });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with the back button that is on my device in
I have this problem that I can ref a button for control it. I
I have a problem that when I click on the image button instead of
I have a problem. I have two refresh button in differents activities that It
I have a page located at x.com. On this page is a button that,
I have a problem with a command button (implementing the ICommand). I want, when
I'm trying to solve the following problem: I have a download button that when
Ok, so I have a button on my website, that I want to link
I have the following HtmlHelper method that I want to create a button that
I have a like/send button that I've set up on a customer's home page.

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.