Jump to content

how can i remove s specific hidden field


toolman

Recommended Posts

Hi there,

 

I am trying to remove a specific hidden field from this code:

 

<form action="form.php" method="get" name="BFORM">
<input type="hidden" name="agent" value="aaa">
<input type="hidden" name="tmp" value="aaa">
<input type="hidden" value="disc" name="tmp">

 

The one I want to remove this one:

 

<input type="hidden" name="tmp" value="aaa">

 

How can I do this with jQuery?

 

Thanks

If you want to remove the one named "tmp" with a value "aaa" you would want something like this.

$("form input[name = 'tmp']").each(function()
{
    if ($(this).val() == "aaa")
        $(this).remove();
});

But, maybe you just wanted to remove the first "tmp" field?

$("form input[name = 'tmp']:eq(0)").remove();

It just really depends on the situation, and you didn't provide much information on what you actually want to accomplish.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.