I have this code for jquery $(function() { $('#test').live('click', function() { $('#test').after('<p>Hello world!</p>'); }); });
and this for php part foreach ($out as $key => $value) { $i = 0; echo $value['name'] . ' : <input id="test'. $i .'" type="text" name="'. $key .'" /><br>'; $i++; } So I have input fields with running ID's. The question is how can I get the text added under the field that was clicked ? And if it has already been added it should not add the text again.