Please take a look at this
http://jsfiddle.net/tt13/CFbpt/
What I need is,
- When user clicks + button, to add new text input
- Hide + button from first text box when text boxes count reaches 3 (user can add max 2 text boxes) and unhide when textbox count < 3
- Remove parent text box (which located to the left from button) when user clicks x button
My + button works well: it adss textboxes on the fly. But x (remove) buttons doesn’t. WHat am I missing?
Yes, the indication is that you are currently setting you’re delete event before the button actuaclly exists. Instead put the delete handler inside the add button event:
http://jsfiddle.net/CFbpt/1/
But really you should be putting your code into the question so that other people can find it…
EDIT: The more dynamic use of .on() which I think you might have been trying to achieve is:
$(document).ready(function(){