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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:04:54+00:00 2026-05-13T17:04:54+00:00

I have a bit of a problem with a jQuery dialog and the way

  • 0

I have a bit of a problem with a jQuery dialog and the way scripts are handled.

In the dialog html, I have

<input id="test"> 

If I do

<script type="text/javascript>
   $('#test').val("haha")
</script>

after the input, it shows up. If I put it before, it doesn’t work.
Now the problem is I’m trying to change the value of $(‘#test’) using a click trigger, and I can’t!

   $('.testbutton').click(function() { 
          alert();      
          $('#test').val("haha");
    });

The alert works, and the initial val replacement works, which means there aren’t any duplicate or missing input areas.

The total script as it is now, not working:

<input type="button" class="testbutton" />
<input type="text" size="10" id="test" name="test" value="">

 $('#test').val("currentvalue"); // This works
       $('.testbutton').click(function() { 
              alert();      
              $('#test').val("haha");
        });

Update
The dialog shows the correct value in #test once the dialog is closed and then reopened. Could this be something I’m missing?

  • 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-13T17:04:54+00:00Added an answer on May 13, 2026 at 5:04 pm

    The problem ended up being the # in test. For some reason the replacement works with a class identifier instead of a id identifier. I suppose it’s because the # will replace only one instance, and for some reason that I have yet to discover, there is more than one instance of the dialog (or a hidden one).

    Thanks for all your suggestions!

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

Sidebar

Related Questions

I have problems with the following bit of javascript/jquery code: this.droppable = function(){ $('.imageWindow
Today I have a bit of a problem. I have an ajax script that
I'm having a bit of a jQuery problem. Basically I have some functions that
I'm a complete beginner with jQuery and I have this bit of script here
I have a bit of a problem with some html im writing and was
I have written a simple jquery script for a content slider. My problem is
I have a bit of jquery that makes an ajax request to a script
I'm facing a little problem with my jQuery / Javascript code. I have several
I'm new to jquery, and I have a bit of a problem. What I
I have this bit of script to widen a text box on mouseover and

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.