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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:22:38+00:00 2026-05-22T03:22:38+00:00

I have an input element, a span, and a div with a background image

  • 0

I have an input element, a span, and a div with a background image property.

<span>Go</span><input id="ImageUrl"/>

<div id="Image"></div>

I’m trying to create a script where if a user pastes/types a link into the input field, then clicks the Go button, the background image property for the div changes to that url.

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

    In < head> :

    <script  type="text/javascript">
        function show() {
            $('#Image').css('background-image', 'url("' + $('#ImageUrl').val() + '")');
        }
    </script>
    

    In < body> :

    <span>Go</span><input id="ImageUrl"  /> <!-- the textbox can get the user input Url of Image-->
    <div id="Image" style="width:200px; height:200px;"></div> <!-- the div which show Image -->
    <input type="button" value="Go" onclick="show()" /> <!-- the GO button -->
    

    If you have problems please let me know 🙂

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

Sidebar

Related Questions

I have an Element Like <div class=control> <label>&nbsp;</label> <input type=checkbox id=1><span class=controlText>Check Box</span> <div
I have a file input element that needs to be cloned after the user
i have an input element, and i want bind both change and keypress event
I have an input[type=radio] element inside a block container of fixed width. The supporting
I have saved input from a textarea element to a TEXT column in MySQL.
With JavaScript, it is quite easy to have an <input> element automatically take on
I have code to create another row (div with inputs) on a button click.
Say I have the following HTML: <div> <span>span text</span> div text <span>some more text</span>
I have the following snippet of code: $(#QnAList).append(<div id=qdiv + i + class=divBase> <span
I have a JavaScript containing a text-input and some placeholders. The script uses a

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.