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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:55:40+00:00 2026-06-13T12:55:40+00:00

I have following html (html may be vary) in php variable. I have used

  • 0

I have following html (html may be vary) in php variable. I have used append function (jQuery) for adding this html but always fail…… (due to not properly formated html). I’ve tried htmlentities,html_entity_decode and htmlspecialchars function for formating html but not success…. 🙁 Any-buddy know how to escaped this html. (either by PHP or jquery and how???? appreciate for your answer)

<tr>
    <td class='paramlist_key'>
        <label id='ID' for='FOR' class='CLASS'>*AT</label>
    </td>
    <td class='CLASS_A'>
        <select id="19" name="Name" class="cc" title="" style="" size="">
            <option value="" >Select below</option>
            <option value="A" selected="selected">A</option>
            <option value="B">B</option>
        </select>
        <span id="mm" style="display:none;">&nbsp;</span>
    </td>
</tr>
  • 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-13T12:55:41+00:00Added an answer on June 13, 2026 at 12:55 pm

    You need to convert the HTML to a valid JavaScript string, which means it has to be 1 line and all “-quotes or ‘-quotes must be escaped, depending on which your outer style will be in the final JS. So something like:

    $html = str_replace("\n", "\\n", $html);
    $html = str_replace('"', '\"', $html);
    

    Or even easier, just json_encode() it and omit the quotes in the JS script itself as json_encode() will add those.

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

Sidebar

Related Questions

This may seem like a simple questiom, but I have the following html <div
I have the following statement in document.ready function: if($(sidebar ).html().trim().length == 0) { $(sidebar).append(<p>&nbsp;&nbsp;&nbsp;The
I have a jQuery slideshow code that works fine with the following HTML structure:
I have the following code: $(document).ready(function(){ $(.datepicker).each(function() { $(this).datepicker({ beforeShowDay: function(date){ return [$(this).parent().find(span.days).html(), ]
I have the following code: $(#myDiv).hover( function () { $(this).clearQueue().animate({ backgroundColor: #d7df23, opacity: 0.95
I have the following HTML <select onchange=this.form.submit() name=name> <option value=9995101E01#17201044055PM>9995101E01#17201044055PM</option> <option value=GRR-Example>GRR-Example</option> <option value=admin>admin</option>
I have the following piece of code <html> <head> <script src=http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js></script> <script> $('body').on('click', 'a.wishlist_item',
I have the following code in a controller: $this->viewdata->scripts = array( 'http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js', 'jstree/jquery.jstree-1.0-rc2.js', 'jquery.hotkeys-0.8.js',
I have following html file (1.html) and once I open it in my browser
I have following HTML: <div class=olympics style=display: block; position: absolute; left: 250px; top: px;>

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.