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

  • Home
  • SEARCH
  • 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 8110881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:54:59+00:00 2026-06-06T01:54:59+00:00

I am trying to print HTML with this JavaScript in the webview, however it

  • 0

I am trying to print HTML with this JavaScript in the webview, however it is literally printing <p>HELLO</p>. How can I fix that?

NSString* statement = [NSString stringWithFormat:@"document.getElementById('test').innerText = '<p>HELLO</p>'"];

[self.myWebView stringByEvaluatingJavaScriptFromString:statement];
  • 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-06T01:55:01+00:00Added an answer on June 6, 2026 at 1:55 am

    I guess you need to use innerHTML instead of innerText.

    Because innerText will simply assign whatever you write there. If your text contains html and you element parse that HTML than you have to use innerHTML for sure.

    Try as follow, may be it will help.

    NSString* statement = [NSString stringWithFormat:@"document.getElementById('test').innerHTML = '<p>HELLO</p>'"];    
    [self.myWebView stringByEvaluatingJavaScriptFromString:statement];
    

    Note
    Your test element must be supporting innerHTML property like div span etc.

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

Sidebar

Related Questions

I am trying to print a table using javascript the table html is like
Trying to use this following script to load a page so that I can
I'm trying to use XSLTs (in Javascript) to pretty-print an XHTML doc that has
I have 145064642 chars long HTML String which I am trying to print. When
I'm trying to print out a list of products on a page. This is
I'm trying to learn some html/css/javascript, so I'm writing myself a teaching project. The
I have a simple button in HTML like this: <input type='button' id='btnPrint' value='Print' onclick=changeStylesheet();
i have this files: JAVASCRIPT $(document).ready(function(){ $('a').click(function(){ $('div').load(formular.html,function(){ $('input[type=submit]').click(function(){ $('form').submit(); }); }); }); });
I'm a beginner to Python trying to decode this javascript sequence. I'm not only
I have been getting this error when trying to parse HTML with a script

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.