Advertisement
marksweb

Django auto slug script

Dec 17th, 2014
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     <script src="{% static "base/js/urlify.js" %}"></script>
  2.  
  3.     <script type="text/javascript">
  4.         (function ($) {
  5.             $(document).ready(function () {
  6.                 document.getElementById("id_name").onkeyup = function () {
  7.                     var e = document.getElementById("id_slug");
  8.                     if (!e._changed) {
  9.                         e.value = URLify(document.getElementById("id_name").value, 50);
  10.                     }
  11.                 }
  12.             });
  13.         })(jQuery);
  14.     </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement