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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:18:32+00:00 2026-06-01T11:18:32+00:00

I have this code <html> <include jquery> <script> function crea() { var html =

  • 0

I have this code

<html>
<include jquery>
<script>
  function crea()
  {
     var html = '<form method="get" id="popUpForm" name="popUpForm" action="form_ricorda_dati.php"><hr /><input type="hidden" name="mio" value="1" />input3<input type="text" name="input3" value="" /><br />input4<input type="text" name="input4" value="" /><br /><input type="submit" id="11" value="Procedi" /></form><br /><a href="" onClick="prova()">submit</a>';
     var div = document.getElementById('cont');
     div.innerHTML = html;
  }

  function prova()
  {
     $('#popUpForm').submit();
  }

</script>
<body>
< a href="#" onClick="crea()">lancia funzione JS</a><br /><br />
<div id="cont"></div>
</body>
</html>

This code:

  1. When I click on <a href="#" onClick="crea()"> it “shows” the form
    into the <div id="cont">
  2. Way 1: When I click on <a href=""
    onClick="prova()">submit</a>
    it calls $('#popUpForm').submit();
    Way 2: Click on <input type="submit" id="11" value="Procedi"
    />

Problem:

  1. If I click <input type="submit" id="11" value="Procedi" /> I
    reload the page and see correct query string (form action="get"). In
    the reloaded page, if I “show” the form and click on the input I see the last
    input (browser autofill okay).

  2. If I click <a href="" onClick="prova()">submit</a>, after, I
    don’t see the query string. In the reloaded page if I “show” the form and
    click on the input I don’t see the last input (browser autofill fails).

(I see this problem in Chrome and IE, but not in Firefox.)

Goal

The browser autofill should always show.

  • 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-01T11:18:34+00:00Added an answer on June 1, 2026 at 11:18 am

    The problem might be that the HTML form you are creating with JavaScript was not in the browser’s DOM at the moment the page was loading. You can fix this by placing the form’s HTML into your body tag to be rendered in the DOM, and hide it with JavaScript until a user clicks the crea link.

    The problem number 2 seems to be that your link ( <a href="" onclick="prova()"... ) might go to the url given in the HREF attribute. Since that attribute is empty, your page goes to itself.

    To make things easier, you should keep your HTML form out of your JavaScript logic. Also since you are using jQuery, I have converted your functions to binds.

    Working example in JSFIddle.

    <html>
        <head>
            <script type="text/javascript" src="url/to/jquery.js"></script>
            <script type="text/javascript">
                jQuery(function(){
                    var form = jQuery( '#form' ),
                        crea = jQuery( '#creaLink' ),
                        prova = jQuery( '#provaLink' );
    
                    form.hide();
    
                    crea.on( 'click', function(){
                        form.show();
                    });
    
                    prova.on( 'click', function(){
                        form.submit();
                    });
                });
            </script>
        </head>
        <body>
            <a href="#" id="creaLink">lancia funzione JS</a>
            <br />
            <br />
            <div id="form">
                <form method="post" id="popUpForm" name="popUpForm">
                    <hr />
                    <input type="hidden" name="mio" value="1" />
                    input3
                    <input type="text" name="input3" value="" />
                    <br />
    
                    input4
                    <input type="text" name="input4" value="" />
                    <br />
    
                    <input type="submit" id="11" value="Procedi" />
                </form>
                <br />
                <a href="#" id="provaLink">submit</a>
            </div>
        </body>
    </html>​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

OK i have this code HTML: <html> <head> <script type=text/javascript src=http://code.jquery.com/jquery-1.7.1.min.js> </script> <script type=text/javascript>
I have this html code <html> <head> <title>JQuery Problem 2</title> <script type=text/javascript src=jquery-1.4.min.js></script> <script
I have this code: <script type=text/javascript> var loader = #loader; $(function() { $(#selUsers).change(function() {
I have this jQuery simple code: <script type=text/javascript> <!-- jQuery(function(){ jQuery('#old_thumb').click(function(){ $(this).val($(this).attr('title')); $('#sf').val('2'); $('#add_new_event').submit();
I have this HTML code for radios: <input type='radio' name='a_27' value='Yes' id='a_27_0' /> <input
I have this html code that i want to edit with jQuery. Here is
I have this html code: <div class=action> some_text <a class=delete_action name=q1>some</a> </div> <div class=action>
I have this HTML code: <div class='com_box'> <div class='com_box_c'> <div class='com_box_info'> <a id='quote'>quote</a> </div>
I have this HTML code: <div id=main> <div id=dv_7>...</div> <div id=dv_1>...</div> <div id=dv_8>...</div> <div
I have this HTML code which simulates a dropdown multi-checkbox <div> <div class=select> <span>Select

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.