Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. <li class="cat_root_li">New Subject<br />
  2. <span class="disc_span">Some EExplanation</span>
  3. <ul>
  4. <li>No Topics currently
  5. </li>
  6. <li id="3">Add a new topic <a href="#" class='new_topic_li' checked_link="0"><img src="images/list-add-2.png" height="28px" style='position:absolute;margin-top:-2px;' /></a>
  7. <div id="new_topic_div"></div>
  8. </li>
  9. <li style="list-style: none">
  10. <br />
  11. </li>
  12. </ul>
  13. </li>
  14.  
  15. <script>
  16. $(document).ready(function(){
  17. $('div#new_topic_div').hide();
  18. var form = "<form id=add_new_topic_form action='' method=POST>n <table class=add_new_topic_form_table border=0>n <tr><td colspan=2><?=tjcg_add_topic;?></td></tr><tr><td valign=top><?=tjcg_form_post_title;?></td><td valign=top><input type=text name=new_topic_title id=new_topic_title><td></tr>n <tr><td valign=top><?=tjcg_form_post_subject;?></td><td valign=top><textarea name=new_topic_text id=new_topic_text class=widgEditor rows='5' cols='45'></textarea></td></tr><tr><td class=add_topic_result></td><td><input type=submit class=submit_btn value='<?=tjcg_form_submit;?>' /> <a class=test_href href=#>link</a></td></tr>n <table>n </form>";
  19. $('a.new_topic_li').on("click",function(e){
  20. e.preventDefault();
  21. var parent= $(this).closest('li')
  22. var checked = $(this).attr('checked_link');
  23. if (checked == 0)
  24. {
  25. parent.find('div#new_topic_div').html(form).show(200);
  26. $(this).attr('checked_link',"1");
  27. }
  28. else{
  29. parent.find('div#new_topic_div').html('').hide(200);
  30. $(this).attr('checked_link',"0");
  31. }
  32. });
  33. });
  34. </script>
  35.  
  36. $(document).on('submit', '#add_new_topic_form', function(){
  37. alert("I've been submitted");
  38. });
  39.  
  40. $('div#new_topic_div').on('submit', 'form#add_new_topic_form', function() {
  41. console.log('submitting');
  42. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement