Store user input in a paragraph

I want to create a unique program that allows users to input text in a field, and when they click "Start", the text will appear in a paragraph backwards. I plan to use Html, jQuery, and CSS for this project. Can anyone provide guidance on how to achieve this?

Below is the HTML code:

<!DOCTYPE html>
<html id="head">
<head>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <script src="BackTalk.js"></script>
    <link rel="stylesheet" type="text/css" href="BackTalk.css">
    <title>BackTalk</title>
</head>
<body id="body">
    <div id="Main">
        <form>
            <input id="input" type="number" value="Start">
            <button id="input2"  onclick="">Start</button>
        </form>
    </div>
    <form id="frm">
        <p id="para"></p>
    </form>
</body>
</html>

And here's the JavaScript (the main part where assistance is needed):

$(document).ready(function () {
    $('#input2').click(function () {
    });
});

CSS section (might be necessary):

#head {
}

#body {
    background-image: url('stardust.png');
}

#Main {
    width: 230px;
    padding: 10px;
    border: 1px double #ffffff;
    border-radius: 10px;
    margin: auto;
}

#frm {
    width: 230px;
    height: 500px;
    padding: 10px;
    border: 1px double #ffffff;
    border-radius: 10px;
    margin: auto;
}

#input {
    border-radius: 10px;
}

#input2 {
    border-radius: 10px;
}

Answer №1

Give this a shot http://jsfiddle.net/UniqueUser123/abcdefg/

 $('#button').click(function () {
  var userInput=$('#inputField').val();
  console.log($('#outputParagraph').text(userInput.split("").reverse().join("")));
 });

Answer №2

Unsure if this is precisely the solution you are seeking:

$(document).ready(function () {
    $('#buttonClick').click(function () {
        $('#result').text($('#textInput').val().split('').reverse().join(''));
    });
});

JSFiddle Link

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Dropdown menu utilizing processing API and interacting with AJAX and DOM manipulation

My API data is not showing up in the dropdown menu. If I use ?act=showprovince, I can see the result. example.html <head> <link rel="stylesheet" type="text/css" href="css/normalize.css"> <link rel="stylesheet" type="text/css" hr ...

Activating Vue-Bootstrap components through an image click event in VueJS 2

Seeking to achieve: VueJS integration with Bootstrap for clickable cards I am currently working on a VueJS project where I want the cards to be clickable and reveal collapsible elements upon click. To accomplish this, I have implemented a button with the ...

Error: Unable to access the 'map' property of an undefined object......Instructions on retrieving a single post

import React,{useEffect, useState} from 'react' //import {Link} from 'react-router-dom' import { FcLikePlaceholder, FcComments } from "react-icons/fc"; const SinglePost = () => { const [data,setdata] = useState([]) co ...

Converting Phone Numbers, Fax Numbers, and Zip Codes for Input into a Database

I'm facing an issue with masked inputs for Phone, Fax, and Zip Code on my webpage. The Phone and Fax numbers are currently formatted as (999) 999-9999, while the Zip Code is in the format 99999-9999. However, when I submit the page, the database requi ...

CSS Problem with Image Overlapping

Attached is an image that I would like to design in HTML. It has been quite successful, but when testing it on different resolutions, the red box seems to move around. The design was created with 100% width and height. <style type="text/css"> ...

Retrieving data from a specific field within a table cell

Why does the value of the select box not get passed in my form scope when it is within its own table cell, but works when the whole form is in a single table cell? Below are examples of working and non-working code: WORKING <tr> <td> ...

Node.js data transmission: Sending information from server to client

In my node project, PUG/Jade files are used to render webpages. Every minute, a JS file updates a redis database and I want the GUI to reflect these changes without requiring a page refresh. Here is an overview of how the data is currently passed: User ...

How can you ensure an image is centered properly when padding is applied?

Is there a way to center an image without affecting padding around it? Check out this sandbox for reference HTML <div class="imageParent"> <figure id='img-div'> <img class='image card' ...

What sets Fetch apart from ajax and XMLHttpRequest that makes it impressively faster?

Over the past few days, I have been working on optimizing a client table for a project. The table contains over 10k clients, and as a result, it was taking a long time to load. The front-end team had implemented pagination, filters, and reordering, which ...

Unable to expand or collapse rows in ng-table

Looking to implement an expand and collapse feature for ng-table, where clicking on a row should expand it to show more detail. However, currently all rows expand on click. Any ideas on how to achieve this? Any assistance would be greatly appreciated, tha ...

How to perfectly align squares in CSS Grid

I'm working on arranging four squares in a grid pattern, two on top and two on the bottom, with equal spacing between them. Currently, the squares shift based on the fr value in CSS grid, resulting in uneven spacing like this: I want to align all fou ...

Problem with BehaviorSubject: next() method is not functioning as expected

My goal is to utilize an angular service for storing and communicating data via observables. Below is the implementation of my service: public _currentLegal = new BehaviorSubject({ name: 'init', _id: 'init', country: 'init& ...

Is there a way to display a message in a div container instead of using the alert box when there is a successful ajax response?

Hey there, I'm currently working on implementing error validation handling for a custom form that I've created. I'm looking to display the error messages in a designated div rather than using the standard browser alert box. Since I'm fa ...

How to Retrieve the td value of an element located below an input tag using jQuery

I'm working with this sample HTML code snippet: <tr> <td align="center" headers=" " class="data"><input type="checkbox" name="the-id" value="4222816"></td> <td headers="HDR1" class="data">RED</td> <t ...

Challenges with displaying css/bootstrap classes within angular2

Experiencing difficulties with CSS/Bootstrap integration when displayed in an angular2 component. When attempting to display the CSS and HTML content in the Index.html file (with proper CSS and JS references), everything functions correctly. However, once ...

Modify the title of the HREF hyperlink

Here is a link I have created: <a href="example.com" id="example1"> Go to example....</a> I am wondering if it is possible to use PHP and jQuery to change the text from "Go to example..." to "Go to example One" when the cursor hovers over it. ...

Is there a way to transform BASE64 encoded HTML into a GIF format using ColdFusion?

I am getting a BASE64 encoded message from a WebService. This message is an interpretation of an HTML page and I can use pre-existing ColdFusion functions to convert and showcase it. However, my requirement now is to generate a GIF image of the HTML conten ...

Express 4 does not support Angular ngRoute

I am trying to set up client-side routes using Angular along with Express 4. I have successfully used the ngView directive as per the guide ngView without Express, but once I enable Express routing, ngRoute stops working. How can I configure Express to wor ...

Remove the presence of a black square when selecting elements using CSS

Update: After some investigation, I discovered that the mysterious black square is actually a part of the scroll bar. By adding the following code snippet: select::-webkit-scrollbar { display: none; } The square no longer appears. Initially, my se ...

Ways to retrieve parameters in getStaticPaths function?

I'm currently working on a Next.js app with Contentful as the CMS. The file structure relevant to my question is: pages -[category] -[slug].js My goal is to access the category value when a user visits category/slug. Currently, I have the category ...