Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function list_add_radio_input(list,name) {
- var items = list.find('li');
- jQuery(items).each( function() {
- var item_id_attr = jQuery(this).attr('id');
- var id = item_id_attr.split('-')[1];
- var span_text = jQuery(this).find('span.text');
- var radio = jQuery('<input type="radio" name="'+name+'" value="'+id+'">');
- span_text.before(radio);
- });
- }
- ##GIVES
- <li id="item-7" class="">
- <input type="radio" value="8" name="type"/>
- <input type="radio" value="7" name="type"/>
- </li>
- ##CHILDREN
- function list_add_radio_input(list,name) {
- var items = list.find('li');
- jQuery(items).each( function() {
- var item_id_attr = jQuery(this).attr('id');
- var id = item_id_attr.split('-')[1];
- var span_text = jQuery(this).find('span.text');
- var radio = jQuery('<input type="radio" name="'+name+'" value="'+id+'">');
- span_text.before(radio);
- });
- }
- ##WORKS but the var id for the children takes the value of the parent id...
- example :
- <li id="item-7" class="">
- <input type="radio" value="8" name="type"/>
- </li>
Add Comment
Please, Sign In to add comment