简体   繁体   中英

Different Values in Form Inputs

I have a simple HTML form that works with a PHP script (to process the values).

For some reason it's not working correctly. After many tests, I inspect the mark-up for the form and I find:

<form id="delete_item_3_form" action="upload/delete_item.php" method="post">
<input type="hidden" value="4" name="item_id">
<input type="hidden" value="test" name="item_info">
</form>

As it should be. Please note that the values for the inputs are hard-coded .

However, if I go to the browser console (I am using Chrome) and write:

$('#delete_item_3_form');

I get:

<form id="delete_item_3_form" action="upload/delete_item.php" method="post">
<input type="hidden" value="4" name="item_id">
<input type="hidden" value name="item_info">
</form>

As you can see the value from the second input, item_info, is empty. Both inputs have a name.

I am not new to Form Handling but I have never seen this. The page mark-up shows one thing in a form, and a simple jQuery call to the same form shows another thing.

I have nothing, on my scripts, changing the value of the inputs.

The form is submitted by the press of a button. Here is the jQuery code:

$('#delete_item').click(function()
{
    $("#delete_item_3_form").submit();
});

How is this happening?

页面中有另一个具有相同ID的表单。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM