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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:53:11+00:00 2026-06-10T20:53:11+00:00

As the title vaguely states, I am having issues adding images to a alert

  • 0

As the title vaguely states, I am having issues adding images to a alert message set using a selector and elements? Not too keen on the nomenclature, but here is what i’ve got so far:

function sendalert(alert)
{
    var img;
    img = document.createElement('img');
    img.scr = 'ico/sign_warning.gif';
    img.height = 16;
    img.width = 16;

    $('#alert').text(alert).slideDown('500', function() {
    $(this).delay(5000).slideUp('500')});
}

Basically, I have a div at the top of my page that .slideDown and displays the message input into the function ($alert). However, since I have to have the slide down div in my header, and this function is farther down- I have to use .text to set the divs output.

Plain text output works fine and dandy at the moment (after several hours of trial and error). What I want to do now is add a small error icon in front of the error text.

I’ve had a hard time finding the .whatever elements? But from the list I found only .add and .load stuck out to me- I’ve tried both, but they didn’t work. Below is my attempt with .add (basically used the same concept for .load)

function sendalert(alert)
{
    var img;
    img = document.createElement('img');
    img.scr = 'ico/sign_warning.gif';
    img.height = 16;
    img.width = 16;

    $('#alert').add(img).text(alert).slideDown('500', function() {
    $(this).delay(5000).slideUp('500')});
}

I appreciate any help and hope i’ve provided enough information to convey my issue,

Thanks!

EDIT:
Caught myself in a derp and fixed

img.scr = '<img src="ico/sign_warning.gif" width="16" height="16"/>';

to what it should be

img.scr = 'ico/sign_warning.gif';

Regardless, it did not resolve my issue.

  • 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-06-10T20:53:12+00:00Added an answer on June 10, 2026 at 8:53 pm

    You’ve got a couple problems. First of all, .add() is not the method you’re looking for. You’re probably looking for .append(). Additionally, when you set the .text() of an jQuery object, that will overwrite any other internal markup (including child elements). So even if you switched to .append(), you’d still have issues.

    So given all that, how about giving this a try:

    $('#alert').text("").append(img).append(text).slideDown('500', function() {
        $(this).delay(5000).slideUp('500');
    });
    

    The point is to clear out anything inside the alert element, then append the image, followed by the text of the alert.

    What would probably be better (and easier to style) would be to have a fixed icon element and a fixed text area inside the alert element, then set these explicitly. But this should at least get you on the right track.

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

Sidebar

Related Questions

Title pretty much says it all. Right now it's using XML as the default
I'm vaguely familiar with the nature of unicode, but I'm not sure how all
Title kinda asks it all. I'm not referring to $_REQUEST , $_SERVER and all
Title edits that reflect a better summary of the question are welcome. I'd like
Title pretty much describes it, I just need to get all the order numbers
Title sais it all really. private bool addToBinary(byte[] msg, string filepath) { bool succ
Title said it all. Some context: I got a search mechanism - search view,
Title pretty much sums it up. Is there a technical name given to a
Title pretty much says it all. The web.config, unchanged from how VS2008SP1 generated it,
Title kinda says it all. The usual SOS command !bpmd doesn't do a lot

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.