tags:

views:

36

answers:

1

is it possible to do such thing with jquery so lets say i have this ingreidents trun this into shoping list with check box

1/4 cup of this 1 cup of that butter salad

A: 

Dunno what your markup looks like, but I'm going to assume it's symatic like this:

<ol id="ingredients">
    <li>1/4 cup of this</li>
    <li>1 cup of that butter salad</li>
</ol>

You could write the following javascript using jQuery to add checkboxes:

$(document).ready(function() {
    $('#ingredients li').prepend('<input type="checkbox" name="ingredients" />');
});

That will add a checkbox inside every LI in the list, in front of the text. You should ideally have the items defined in a list like I showed, that makes it a lot easier to figure out what each item is.

Parrots