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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:39:04+00:00 2026-06-04T16:39:04+00:00

Here’s my current code: $(document).ready(function(){ $(input#url).bind(textchange,showPage); $(input#url).focus(); $(form#surlform).submit(function(){ var url = $(input#url).val(); $.get(api/create.php?url= +

  • 0

Here’s my current code:

$(document).ready(function(){
    $("input#url").bind("textchange",showPage);
    $("input#url").focus();


    $("form#surlform").submit(function(){
        var url = $("input#url").val(); 
        $.get("api/create.php?url=" + url, function(data) {
                $("input#url").val(data);
                $("input#url").select();
            });

        return false;
    });
    });

$(document).click(function(){
    showPage();
});
$(document).mousemove(function(){
    showPage();
});

At the moment, when the form is submitted, jQuery stops it from reloading the page, and simply pulls the required output from the API.
If possible, I’d like to make it also change the button, so that the button text is different, and it links to a page instead of submitting the form with jQuery. (If it helps, the button it changes to can be a div – only the original button needs to be button for form).

That’s not all…
I’d then like it to change BACK to the button that submits the form via jQuery with the original text when the text in the text field is altered.

This is quite a big ask, but if anyone’s got a way to go about this, I’d be very grateful.

  • 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-04T16:39:06+00:00Added an answer on June 4, 2026 at 4:39 pm

    Something like this?:

    HTML:

    <form id="someForm">
        <input id="someInput" type="text" />
        <input id="submitButton" type="submit" />
        <input id="linkButton" type="button" value="Submit" />
    </form>​
    

    CSS:

    #linkButton { display: none; }​
    

    JavaScript:

    $('#someForm').submit(function () {
        $('#submitButton').hide();
        $('#linkButton').show();
        return false;
    });
    
    $('#linkButton').click(function () {
        alert('use something like window.location here to act like a link');
    });
    
    $('#someInput').change(function () {
        $('#linkButton').hide();
        $('#submitButton').show();
    });
    

    It’s overly simple at the moment and could likely use some improvement, but the idea is straightforward enough…

    1. When the page initially loads, the “link” button is hidden.
    2. Any time the “submit” button is clicked, the “submit” button is hidden and the “link” button is shown. (Naturally after whatever AJAX you’re doing, not included here for brevity.)
    3. Any time the “link” button is clicked, do something. In your case it’s to act as a link, right? window.location = 'some new location'; essentially.
    4. Any time the text changes, the “link” button is hidden and the “submit” button is shown. In the event that they were already hidden and shown, no harm done. (There’s probably a more elegant and less show-and-hide-every-time way to do this, but it gets the job done.)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my code, which takes two version identifiers in the form 1, 5,
Here is the code: Function getData(ByVal id As String) Dim reader As SqlClient.SqlDataReader Dim
here is code: <script type=text/javascript> function doit(){ $('table td').each(function () { if ($(this).text().trim() !=
Here is some simple code: DIR* pd = opendir(xxxx); struct dirent *cur; while (cur
Here's the code in AlertTableView: - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ NSInteger index = 12345; NSLog(@AlertTableView:
Here's my scenario: <!-- Normal Control --> <div class=required> <label for=address1>Address line 1</label> <input
Here is an example: I write html code inside of textarea, then I swap
Here's a problem I ran into recently. I have attributes strings of the form
Here is my code...I have two dimensional matrices A,B. I want to develop the
Here is my code sample, let me know if it can be further improved?

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.