Advertisement
Guest User

Untitled

a guest
Jul 25th, 2017
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. var div = $("<div></div>");
  2. $("#box").append(div);
  3.  
  4. $("#box").append("<div></div>");
  5.  
  6. var $div = $("<div>", {id: "foo", "class": "a"});
  7. $div.click(function(){ /* ... */ });
  8. $("#box").append($div);
  9.  
  10. $('#box').append(
  11. $('<div/>')
  12. .attr("id", "newDiv1")
  13. .addClass("newDiv purple bloated")
  14. .append("<span/>")
  15. .text("hello world")
  16. );
  17.  
  18. // create an element with an object literal, defining properties
  19. var $e = $("<div>", {id: "newDiv1", name: 'test', class: "aClass"});
  20. $e.click(function(){ /* ... */ });
  21. // add the element to the body
  22. $("#box").append($e);
  23.  
  24. jQuery('<div/>', {
  25. "id": 'foo',
  26. "name": 'mainDiv',
  27. "class": 'wrapper',
  28. "click": function() {
  29. jQuery(this).toggleClass("test");
  30. }}).appendTo('selector');
  31.  
  32. var fileImportStatus;
  33. $('#id').change(function(){
  34. if($('#id').is(':checked')){
  35. fileImportStatus = "<strong>ON</strong>";
  36.  
  37. }else {
  38. fileImportStatus = "<strong>OFF</strong>";
  39. }
  40. });
  41.  
  42. $('#saveBtn').click(function(){
  43. $('#fileImportStatusTxt').empty();
  44. $('#fileImportStatusTxt').append('File Import is ' + fileImportStatus);
  45. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement