jquery how to make insertBefore work only once, on first click?
        Posted  
        
            by user313271
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by user313271
        
        
        
        Published on 2010-04-14T09:49:56Z
        Indexed on 
            2010/04/14
            9:53 UTC
        
        
        Read the original article
        Hit count: 321
        
jquery
$(function(){
 $('#4').click(function() {
 $('<input name="if4" type="text" value="other price>"').insertBefore('form textarea');
   });
 });
html
    <form>
< input name="name" type="text" value="Enter your name" /><br />
< input name="contacts" type="text" value="Contact info" /><br />
< select name="services">
< option value="1">1</option>
< option value="2">2</option>
< option value="3">3</option>
< option id="4" value="Other">4</option>
< /select><br />
< textarea name="description">Description</textarea><br />
< /form>
And one more question about it, when i press on option number 4 two time,there appears 2 new fields, is there any way how to fix it, that new field appear only 1 time, after first click ?
© Stack Overflow or respective owner