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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T18:08:17+00:00 2026-05-12T18:08:17+00:00

I have below code in html <div id=divTest> Hello <input type=text id=txtID/> <input type=text

  • 0

I have below code in html

<div id="divTest">
        Hello
        <input type="text" id="txtID"/>        <input type="text" id="txtID"/>        
    </div>
    <input type="button" value="Click" />

and I am trying to modifiy innerhtml to get the value of all the controls in my form on runtime in firefox.

please see the javascript code below:

<script type="text/javascript">   

(function($)
 {
  var oldHTML = $.fn.html;

  $.fn.formhtml = function() {
    if (arguments.length) return oldHTML.apply(this,arguments);
    $("input,textarea,button", this).each(function() {
      this.setAttribute('value',this.value);
    });
    $(":radio,:checkbox", this).each(function() {
      // im not really even sure you need to do this for "checked"
      // but what the heck, better safe than sorry
      if (this.checked) this.setAttribute('checked', 'checked');
      else this.removeAttribute('checked');
    });
    $("option", this).each(function() {
      // also not sure, but, better safe...
      if (this.selected) this.setAttribute('selected', 'selected');
      else this.removeAttribute('selected');
    });
    return oldHTML.apply(this);
  };

  //optional to override real .html() if you want
  $.fn.html = $.fn.formhtml;
});
$(document).ready(function() 
{ 
    $('input[type=button]').click(function() {
        alert($('#divTest').html()); 
    });
});
</script>

the above function is not working for me. I want to call innerHtml of div id “divTest”
after it’s control value is assigned to it. please have look into above code and let me know what I need to modify in above code

  • 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-12T18:08:18+00:00Added an answer on May 12, 2026 at 6:08 pm

    I solved my problem by using below jQuery

     <script type="text/javascript">   
    
    
    
    $(document).ready(function() 
    
    
    
     {
    
      var oldHTML = $.fn.html;
    
    
    
      $.fn.formhtml = function() {
    
        if (arguments.length) return oldHTML.apply(this,arguments);
    
        $("input,textarea,button", this).each(function() {
    
          this.setAttribute('value',this.value);
    
        });
    
        $(":radio,:checkbox", this).each(function() 
    
        {
    
    
    
          if (this.checked) this.setAttribute('checked', 'checked');
    
          else this.removeAttribute('checked');
    
        });
    
        $("option", this).each(function() 
    
        {      
    
          if (this.selected) this.setAttribute('selected', 'selected');
    
          else this.removeAttribute('selected');
    
        });
    
        return oldHTML.apply(this);
    
      }; 
    
      $.fn.html = $.fn.formhtml;
    
    });
    
    $(document).ready(function() 
    
    { 
    
        $('input[type=button]').click(function() {
    
            alert($('#divTest').html());
    
        });
    
    });
    
        </script>
    

    and the html was as below:

    <div id="divTest">
    
        Hello
    
        <input type="text" id="txtID" />
    
        <input type="text" id="txtID" />
    
        <input type="text" />
    
        <input type="text" id="Text1" />
    
        <input type="text" id="Text1" />
    
        <input type="text" />
    
        <input type="text" />
    
        <input type="text" />
    
        <input type="text" id="Text5" />
    
        <input type="text" id="Text6" />
    
    </div>
    
    <input type="button" value="Click" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 206k
  • Answers 206k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Seems recreating the plist fixed my issue. Works in simulator… May 12, 2026 at 9:14 pm
  • Editorial Team
    Editorial Team added an answer First, find all intersections of edges, add these intersections to… May 12, 2026 at 9:14 pm
  • Editorial Team
    Editorial Team added an answer The 3rd parameter of GetObject() needs to simply be an… May 12, 2026 at 9:14 pm

Related Questions

I have below html code in my aspx. <input type=hidden id=medicalLink value='<a href=/forms/contactus.aspx >Contact
I have below html: <div class=threeimages id=txtCss> <a> <img alt=Australia src=/Images/Services%20button_tcm7-9688.gif/> </a> <div class=text
I have the below HTML code, also I will have a textbox for entering
I'm trying to use jquery and blueprint css to do a (so i thought)
I'm currently working on a jQuery script that will translate the site's text into

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.