This is the sort of situation where a demo page would really help. Can you
put any of this on a public server?
Blair
On 12/21/06, Andy Matthews <[EMAIL PROTECTED]> wrote:
I'm working with recipes and I want to use some jQuery goodness to clone a
DOM construct that will contain a few form fields so that adding
ingredients
is easy, and fun. I thought that it would be pretty easy to code but it's
giving me some trouble and I wanted to see if you guys could help me out.
My HTML:
<ol id="ingList">
<li class="ingredient"><input type="text" name="ing_01"><input
type="button" class="addIng" value="+"></li>
</ol>
Here's the jQ code I have thus far:
$(document).ready( function(){
$('#ingList .ingredient .addIng').click( function() {
$('#ingList
.ingredient').clone().appendTo('#ingList:last-child');
});
});
The goal is that the user would fill the first field then click the "+"
button. Then the following would occur:
1) Clone current LI tag
2) Append it to itself.
3) Clear the value from the form field
4) Increment the name value of the form element, ing_01, ing_02, etc.
5) Lastly, remove the plus button from the elemet just previous to the new
one.
I'm working with various jQ methods but I can't seem to get this working.
Does anyone have input on this?
<!----------------//------
andy matthews
web developer
certified advanced coldfusion programmer
ICGLink, Inc.
[EMAIL PROTECTED]
615.370.1530 x737
--------------//--------->
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/