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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:53:41+00:00 2026-05-13T13:53:41+00:00

EDIT: Thanks guys – perfect! I wish I could check more than one answer,

  • 0

EDIT:

Thanks guys – perfect! I wish I could check more than one answer, since you both gave me the right answer. Quick response!


I have the following jQuery function:

$(document).ready(function(){ 
      $('#login_btn').click(function(){
        $("#message").text("button was pushed"); 
    }); 
});

It works – the text of the message div changes when I click the button. But it instantly reverts back to it’s state when loaded. So all you really see is a quick flash and then it’s gone.

I am using codeigniter. The script above is named “login_attempt” and is in a file folder named “javascript” at my project root. It is the only thing in that file. Below is the outputted html source.

<html>
<head>
    <script language="javascript" src="path to jquery-1.4.min.js"></script>
    <script type="text/javascript" src="path to login_attempt.js"></script>

    <title>Login Page</title>
</head>
<body>
    <div id="message">this will become something else</div>
      <button id="login_btn">Click Me</button>
</html>

I’m just now learning jQuery, but I thought when the text was changed it was supposed to stay changed. Could someone advise me on how to make sure the change remains?

Thanks.

  • 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-13T13:53:41+00:00Added an answer on May 13, 2026 at 1:53 pm
    $('#login_btn').click(function(){
        $("#message").text("button was pushed");
        return false;
    }); 
    

    return false to prevent the form submit.

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

Sidebar

Related Questions

Why new()/delete() is slower than malloc()/free()? EDIT: Thanks for the answers so far. Please
EDIT: I'm still waiting for more answers. Thanks! In SQL 2000 days, I used
UPDATE: Solved. Thanks BusyMark! EDIT: This is revised based on the answer below from
How do I do an inverse join with more than one key column? In
edit: many thanks for all the answers. Here are the results after applying the
Please let me know if you have any idea about it. Thanks EDIT What
EDIT : This question duplicates How to access the current Subversion build number? (Thanks
Edit: From another question I provided an answer that has links to a lot
Guys, im more of a MSSQL guy but im working on some MYSQL right
EDIT: I have fixed all but two warnings now, so thank you all for

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.