Skip to content

Commit

Permalink
The attribute-adding edit form javascript should actually work.
Browse files Browse the repository at this point in the history
  • Loading branch information
lazyatom committed Jul 17, 2008
1 parent c4ae2d9 commit edff450
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions lib/vanilla/public/javascripts/vanilla.js
@@ -1,16 +1,21 @@
$(document).ready(function() {

$('a#add').click(function() {
$('dl.attributes').append('<dt><input class="attribute_name" type="text"></input></dt><dd><textarea></textarea></dd>');
return false;
});

function vanillaPrepareEditor() {
$('input.attribute_name').change(function() {
var dl_children = $('dl.attributes').children();
var dt_index = dl_children.index(this.parentNode) + 1;
var textarea_for_this = dl_children[dt_index].childNodes[0];
textarea_for_this.name = this.value;
});
}

$(document).ready(function() {

$('a#add').click(function() {
$('dl.attributes').append('<dt><input class="attribute_name" type="text"></input></dt><dd><textarea></textarea></dd>');
vanillaPrepareEditor();
return false;
});

vanillaPrepareEditor();

});

0 comments on commit edff450

Please sign in to comment.