Advertisement
thetenfold

Untitled

Nov 3rd, 2013
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var AC = JSL('#add_comment');
  2.  
  3. function handleChange(event) {
  4.     var area = AC.find('textarea.comment_form');
  5.  
  6.     // add the selected value onto the textarea's value
  7.     area.prop('value', area.prop('value') + this.options[this.selectedIndex].value);
  8. }
  9.  
  10. // add our <select> tag
  11. AC.prepend(
  12.     JSL.create('select', {onchange : handleChange}, [
  13.         JSL.create('option', {}),
  14.         JSL.create('optgroup', {label : 'Header One'}, [
  15.             JSL.create('option', {value : 'one', textContent : 'Option One'}),
  16.             JSL.create('option', {value : 'two', textContent : 'Option Two'})
  17.         ]),
  18.         JSL.create('optgroup', {label : 'Header Two'}, [
  19.             JSL.create('option', {value : 'three', textContent : 'Option Three'}),
  20.             JSL.create('option', {value : 'four', textContent : 'Option Four'})
  21.         ])
  22.     ])
  23. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement