Jump to content

Function Only Works Once


The Little Guy

Recommended Posts

I am using jQuery and I have a drop down menu and when a user select the option "New Option" a text box is un-hidden they enter the new option, and press add. jQuery I send the value of the textbox to a php file which adds the option to the database, then I have a php function which rebuilds the drop down with the new value in it and the hidden box. I then add those to the page (over writing the old drop down and hidden textbox).

 

The problem I am having is that I can do this one time the second time this no longer works unless I reload the page. What is causing this?

Link to comment
https://forums.phpfreaks.com/topic/252339-function-only-works-once/
Share on other sites

It's probably because you destroyed the previous

 

Options include:

a) Use jQuery's .live().

b) Reattach the event handler to the new

c) Have the PHP only output

d) Use JavaScript to add the new

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.