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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:25:42+00:00 2026-06-03T05:25:42+00:00

I am trying to append this: ‘<div>’ + htmlEncode(imagefilename) + ‘</div>’ when the user

  • 0

I am trying to append this: '<div>' + htmlEncode(imagefilename) + '</div>' when the user clicks on the cancel button (.imageCancel). But it is giving me this error: $('<div/>').text(value).html(); is not a function. How can this error be fixed? Is it because

$('.cancelImage').eq(window.lastUploadImageIndex).append('<div>' + htmlEncode(imagefilename) + '</div>'); 

is in the $(".imageCancel").on("click", function(event) { function?

function htmlEncode(value) {
    return $('<div/>').text(value).html();
}


function startImageUpload(imageuploadform, imagefilename) {


    $(".imageCancel").on("click", function (event) {

        $('.cancelImage').eq(window.lastUploadImageIndex).append('<div>' + htmlEncode(imagefilename) + '</div>');

        var image_file_name = $(this).attr('image_file_name');
        jQuery.ajax("deleteimage.php?imagefilename=" + image_file_name)

        $(this).parent().remove();

        $('.upload_target').get(0).contentwindow

        return stopImageUpload();

    });

    return true;
}
  • 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-03T05:25:43+00:00Added an answer on June 3, 2026 at 5:25 am

    Try changing the function to

    function htmlEncode(value) { return $('<div/>').text(value || '').html(); }
    

    I suspect that .text() might be a little un-rigorous about testing its argument, and interpreting a null as meaning that you want the function to return the current text content of the selected element.

    Now, as to why the argument would be null, well, that depends on the rest of your code.

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

Sidebar

Related Questions

I'm trying to append this string: &lt;div&gt; hello &lt;/div&gt; as an HTML node, but
I'm trying to merge (append) 3 videos using AVAssetExportSession, but I keep getting this
When trying to append one div to another Im finding that this doesn't work:
<div id=descbox><div id=scripbox><h1 id=itemname></h1></div></div> This is the markup and i'm trying to append into
I'm trying to append text lines with this code SendMessage(Form1.log.Handle, WM_SETTEXT, 0, Integer(PChar(textLog))); //
I'm trying to append a string of svg elements to the dom. This is
This is what I'm trying to do: $('<abc/>').append('<x/>').html() I expect it to be: <abc><x/></abc>
I'm trying to append some data to a file, but in some cases want
I'm trying to append the integral return value of localtime (in Perl) but I
I'm trying to append a list of Columns to this xml file: <?xml version=1.0

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.