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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:31:52+00:00 2026-05-16T07:31:52+00:00

I FORMULATED MY SELF VERY BADLY! I will start over :) I appreciate your

  • 0

I FORMULATED MY SELF VERY BADLY!

I will start over 🙂 I appreciate your good answers, and if you can, try answering this: ( I will try to be more specific this time)

What I want is, that a <form>element onsubmit, onclick of a button or whatever takes the value of an <input type="text" value="Default value"> and inserts it in a couple of <span>elements, I like to call “placeholders”. This sample might explain it a little better:

<head>
<script type="text/javascript">
$(document).ready(function() 
{
$("input[type=button]").click(function //click the button
{ do_the_magic_thing() //make the value from id="txt_inp" appear in class="placeholder"
}); 
});
</script>
</head>

<body>
<form method="POST" action="" id="theForm"> //could also be get, I don't care
<input type="text" id="txt_inp" value="Default Value" onfocus="if (this.value == Default Value) this.value=''"> //this SHOULD make the Default Value dissapear on focus
<input type="button"> //could also be a submit

<span class="placeholder"></span> //$("#txt_inp").value; goes here
<span class="placeholder"></span> //$("#txt_inp").value; goes here
</body>

Now, is it really as simple as this?:

var do_the_magic_thing = function() {
$(".placeholder").html = $("#txt_inp").value;
};

I’m going to bed now – it’s late in Denmark 🙂 I will answer your comments tomorrow 🙂

OLD POST:


I am very new to this jQuery thing, but I do understand the basics and all. Let’s simplify and say I have a form which looks like this:

<form method="POST" action="">
<input type="text" value="Default value">
<input type="submit" value="Click me">
<input type="hidden"> //hidden is for being able to submit by hitting enter
</form>

I’ve tried with $.post, but I just cannot get it right; it’s not working for me.

Now, I would like to cancel the submit (can’t that be done by just adding a return false; in the function returning the value, if a such is present?), but this is not crucial.

I think I typed in something like

$.post("test.php", function(data) {
alert("This is the data submitted (and cancelled):" + data);
}); //I have also tried without the "test.php", that's not it

Can you tell me, what I’m doing wrong please? 🙂

NOTE

It is not necessary, that the submit is cancelled, but I would like that
Nor is it necessary, that POST is the method used, but once again, this is what I prefer

  • 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-16T07:31:53+00:00Added an answer on May 16, 2026 at 7:31 am

    To answer the revised version of your question, yes, it really is that simple, although the correct syntax for your “do the magic thing” function is the following:

    var do_the_magic_thing = function() {
        $('.placeholder').html($('#txt_inp').val());
    };
    

    P.S. Don’t worry too much about not expressing yourself, your English is much better than my Danish.

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

Sidebar

Related Questions

My question may be not very good formulated because I haven't worked with MongoDB
i've already opened a question for this problem, but it was very bad formulated
This is a simple question but I can't seem to get it formulated right.
I'd very much appreciate anyone sharing best-practices, patterns, anti-patterns, backup, rollback processes that you
After reading a few posts here I formulated this function which is sort of
Please bear with me if this question isn't well formulated. Not knowing is part
First off, I know my title can be formulated better, but my math classes
This question is similar to a previous question of mine , but I formulated
The question seems pretty well formulated I have a virtual machine which implements only
I'm discarding the old question for a better formulated question. I'm using the twitter

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.