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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T11:10:41+00:00 2026-05-28T11:10:41+00:00

I am trying to first getting the value of a div, then adding character

  • 0

I am trying to first getting the value of a div, then adding character such as (+,-,%) to the value where there are spaces. Once done, I then need to set this value on another div. Is this possible to do in jquery. Is this possible to do i am a little confused.

Currently I can get the value of a div using:

$(document).ready ( function () {
$("#btn1").click ( function () {
alert ( $(".eventLocation").html() );
});

});

alert is used to check that I actually get the value of . This works fine, but then I am not too sure on how to add the characters if the value has spaces. For example if the value in the div is “RH3 3HF” then the character “+” has to be added where the space is so in between “RH3” and “3HF”. Then this formatted value has to be to another div.

Any suggestion on this will be greatly appreciated as I am not too sure on how to proceed.

  • 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-28T11:10:42+00:00Added an answer on May 28, 2026 at 11:10 am

    this should do what you need…

    var text = $("#Div1").text();//get the text of the first DIV
    text = text.trim();//trim the text to remove any leading and trailing whitespace
    text = text.replace(/\s/g, "+");//replace all whitespace values with a "+"
    $("#Div2").text(text);//set the text value of the second DIV
    

    Here is a working example

    Based on your comments…

    Assuming that Div1 only has one link you can do this to get the href value…

    var href = $("#Div1 A").attr("href");
    $("#Div2").html('<iframe scr=' + href + '></iframe>');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a page where there are two dropdown menus, and then
I'm having a problem with getting and dropping the first value from list in
I'm trying to retrieve a value of a key but i'm only getting the
Ok, after failing to read a polynomial, I'm trying first a basic approach to
First time trying to deal with users logging in with ASP.net and haven't had
I'm trying out my first Spring project and must be doing something really stupid
this is my first time trying to use document classes in AS3 and im
It's my first time trying to make anything really interesting in C# and I
Hey everyone, my first time trying to draw a multi-color gradient in actionscript 3.
Please excuse me, today is my first day trying to setup a CI environment

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.