Advertisement
Guest User

Untitled

a guest
Feb 19th, 2018
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. $(document).ready(function() {
  2. var predvolba = $('#predvolbaEditace').val();
  3. $(function() {
  4. $('#predvolbaEditace').keydown(function() {
  5. predvolba = $('#predvolbaEditace').val();
  6. console.log(predvolba);
  7. });
  8. console.log(predvolba);
  9. if (predvolba == "") {
  10. $('#predvolbaEditace').focus(function() {
  11. $(this).val("+ ");
  12. });
  13. $('#predvolbaEditace').blur(function() {
  14. $(this).val("");
  15. });
  16. }
  17. })
  18. $("#predvolbaEditace").keydown(function(event) {
  19. console.log(this.selectionStart);
  20. console.log(event);
  21. if (event.keyCode == 8) {
  22. this.selectionStart--;
  23. }
  24. if (this.selectionStart < 2) {
  25. this.selectionStart = 2;
  26. console.log(this.selectionStart);
  27. event.preventDefault();
  28. }
  29. });
  30. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement