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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:00:39+00:00 2026-05-25T03:00:39+00:00

Overview: I got a website that has sentences that people can post to facebook,

  • 0

Overview:
I got a website that has sentences that people can post to facebook, but in each sentence there are input boxes, which people can change the default value. Kinda like an digital “Mad Lib”.

EXAMPLE
I like __ and I think he is __.

  • the underscores would be a text-field with a default value that would disappear once someone focuses on it.

Final string: I like JEN and I think she is HOT.

GOAL
Save final String and Post to Facebook (not worried about the facebook yet)

HTML

<span>I like</span>
<input name="post1_1" value="Tom" type="text" id="post1_1" />
<span>I think she is</span><input name="post1_2" value="Nice" type="text" id="post1_2" />

<a href="javascript:Post1()">POST NOW</a>

<span>My website is</span>
<input name="post2_1" value="Great" type="text" id="post2_1" />

<a href="javascript:Post2()">POST NOW</a>

SCRIPT

<script type="text/javascript" src="js/jquery-1.6.2.min.js"></script>

<script>
var post1_1 = null;
var post1_2 = null;
var post2_1 = null;

function Post1(){
var post1_1 = $('#post1_1').val();
var post1_2 = $('#post1_2').val();
var post1 = 'I like ' + post1_1 + ' I think she is ' + post1_2;
alert(post1);
}

function Post2(){
var post2_1 = $('#post2_1').val();
var post2 = 'My website is ' + post2_1;
alert(post2);
}

</script>

I am very new to web any help would be appreciated.

  • 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-25T03:00:40+00:00Added an answer on May 25, 2026 at 3:00 am

    At a quick glance, there are a few things wrong with your script.

    post1_1 = ('#post1_1').val();
    post2_1 = ('#post2_1').val();
    post2_2 = ('#post2_2').val();
    

    I’m assuming you’re using jQuery here. You need the $ in front of the ().

    post1_1 = $('#post1_1').val();
    post2_1 = $('#post2_1').val();
    post2_2 = $('#post2_2').val();
    

    Second, you set these after you set the post variables.

    var post1 = 'Your are' + post1_1;
    var post2 = 'You smell like' + post2_1 + 'and' + post2_2;
    

    This will be “Your are null” (which, i’m assuming should be “You are”). You should set the variables to the input values before you use them.

    var post1_1 = $('#post1_1').val();
    var post2_1 = $('#post2_1').val();
    var post2_2 = $('#post2_2').val();
    
    var post1 = 'Your are' + post1_1;
    var post2 = 'You smell like' + post2_1 + 'and' + post2_2;
    
    alert(post1);
    alert(post2);
    

    I know this is just an example, but there is no post2_2 in your HTML, and the sentences in the HTML don’t match those in the JavaScript.

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

Sidebar

Related Questions

I've got a really simple problem but I just can't sort it, fairly new
We've got a company wiki running Mediawiki on our intranet that has been in
I've got this problem that I can't solve. Partly because I can't explain it
This scripts works in all browser's but IE7.. Overview: I got a page of
I have an overview list, with divs, and also each div has a pair,
I've got an interface inheritance issue that has been vexing me for some time.
I've got the following code below. High level overview is that it is a
Problem Overview: My application has an enrollment form. Users have a habit of entering
I'm trying to build a quick overview that shows the upcoming calendar week. I
I've got a large ECommerce website running LAMP and was wondering how best to

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.