Effects on elements created with document.createElement

Effects on elements created with document.createElement

Hey there,

The issue I'm having is effects like .slideDown() are not working correctly on elements appended to the DOM after page load. I have a $.post() call and I get the result. I add the result to my page using document.createElement() and then finally want the result to slideDown() but it just magically appears with no affect.

  1. $('#category_list').append('<div id="category_row'+category_id+'" style="display:none;"></div>');

  2. /* ++++TITLE+++++ */
  3. var div1 = document.createElement('div');
  4. div1.setAttribute('id', 'category_title_'+category_id);
  5. div1.className = 'grid_4';
  6. div1.innerHTML = '<strong>' + category_order + '. ' + category_name + '</strong>';
  7. $('#category_row_'+category_id).append(div1);

  8. /* ++++EDIT+++++ */
  9. var div2 = document.createElement('div');
  10. div2.setAttribute('id', 'category_edit_'+category_id);
  11. div2.className = 'grid_4';

  12. var button = document.createElement('button');
  13. button.innerHTML = document.getElementById('edit_text').innerHTML;
  14. button.onclick = function(){
  15. editCategory(category_id, category_name, category_order);
  16. }
  17. div2.appendChild(button);
  18. $('#category_row_'+category_id).append(div2);
  19. /* ++++REMOVE+++++++ */
  20. var div3 = document.createElement('div');
  21. div3.className = 'grid_4';
  22. div3.setAttribute('id', 'category_remove_'+category_id);

  23. var button2 = document.createElement('button');
  24. button2.innerHTML = document.getElementById('remove_text').innerHTML;
  25. button2.onclick = function(){
  26. removeCategory(category_id);
  27. }
  28. div3.appendChild(button2);
  29. $('#category_row_'+category_id).append(div3);

  30. /* +++++CLEAR+++++ */
  31. var div4 = document.createElement('div');
  32. div4.className = 'clear';
  33. $('#category_row_'+category_id).append(div4);

  34. /* +++++++++++++++++ */
  35. $('#category_row_'+category_id).slideDown('slow');

On line 1 I initially had the category_row_category_id div created with document.createElement as well -- I had just changed it to see if that was the issue.

I did a search on the forum and found a post about ajax calls messing with effects but its just a bunch of jibberish.


Thanks in advance,
Lang14