daily pastebin goal
14%
SHARE
TWEET

Untitled

a guest Nov 22nd, 2017 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
  2.  
  3. <input id="inputtext" type="text">
  4. <button id="submit">Submit</button>
  5. <div id="returned_result"></div>
  6.  
  7.  
  8. <script>
  9. $("#submit").click(function(){
  10.  
  11.     var content=$("#inputtext").val(); //get the value of input field
  12.  
  13.     $.post("testclick2.php", {content:content}, function(result){
  14.     $("#returned_result").prepend(result);
  15.      });
  16.  
  17.     $("#inputtext").val(""); //clear the input area
  18.  
  19. })
  20.  
  21. </script>
  22.    
  23. <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
  24.  
  25. <?php
  26. $content=$_POST["content"];
  27. echo "<div class="content">".$content."</div>"."<br>";
  28. ?>
  29.  
  30. <script>
  31. $(".content").click(function(){
  32.     alert("clicked");
  33. })
  34. </script>
  35.    
  36. $("#submit").off('click');
  37. $("#submit").click(function(){...}
  38.    
  39. $(".content").off('click');
  40. $(".content").click(function(){...}
  41.    
  42. $('body').on('click', '.content', function() {
  43.     alert("i've been clicked once");
  44. });
  45.    
  46. <?php
  47.     $content=$_POST["content"];
  48.     echo '<div class="content">' . $content . '</div>' . '<br>';
  49. ?>
RAW Paste Data
Top