jquery

Limit numbers after decimal, add 0 if one digit

梦想与她 提交于 2021-02-05 07:10:02
问题 I'm trying to make a text field so that if there's a number 153.254, that becomes 153.25. And if the field contains 154.2, an extra 0 is added to fill two spots after decimal; 154.20. toFixed() works great but I don't want the number rounded. Also came across other solutions where if I'm typing in 1.40, then if I move the cursor back after 1, I can't type anything in unless I clear the field and start over. Is there a simple jQuery way to limit two characters after a decimal, and then if

Using non-standard attributes

人走茶凉 提交于 2021-02-05 07:09:55
问题 I am having trouble passing around values without using global variables when I am creating html/jquery applications. Quick example 1) Load a table with a class such as "playersTable" 2) Attach a unique ID such as "25" 3) Click on the table row and spawn a row of buttons that will perform actions based on the parent's class and ID; such as query playersTable WHERE row = 25, etc. The issue is that, as I am developing, I need to tie more and more values to the parent element (or any element

How to prevent a user from getting password field value in console

旧巷老猫 提交于 2021-02-05 07:09:43
问题 I have been helping out some people with their computers and repairing them. One of these people asked me about the safety of storing passwords in the auto form field. I showed them a quick trick on how you can retrieve the password from a simple jQuery call in the console. While working on some websites, I have been trying to figure out a way of preventing the use of this trick to find out what the saved password is. To understand what im talking about if you dont know, try the following.

JQuery - Disable scroll wheel until animation is completed

半腔热情 提交于 2021-02-05 07:09:42
问题 I am trying to disable mousewheel on mousewheel event and only enable it after the action is completed. $(window).on('DOMMouseScroll mousewheel', function (event) { //disable mousewhell until the following animation is complete $('.box').animate({ margin: div_offset+'px 0 0 0' }, 500); //enable mousewhell return false; }); I would also like the code to ignore every scroll after the first one, until the animation is complete. In this particular case, I want the animation to complete only once,

Limit numbers after decimal, add 0 if one digit

牧云@^-^@ 提交于 2021-02-05 07:09:37
问题 I'm trying to make a text field so that if there's a number 153.254, that becomes 153.25. And if the field contains 154.2, an extra 0 is added to fill two spots after decimal; 154.20. toFixed() works great but I don't want the number rounded. Also came across other solutions where if I'm typing in 1.40, then if I move the cursor back after 1, I can't type anything in unless I clear the field and start over. Is there a simple jQuery way to limit two characters after a decimal, and then if

Redirect to new page after receiving data from Javascript

吃可爱长大的小学妹 提交于 2021-02-05 07:09:37
问题 I'm trying to pass a Javascript array to my Django views. This works, but I would like to manipulate that data and display it in a separate url. So I have a products page, where you select items. When the form is submitted, this javascript is called, and I want it to redirect to a cart page: $("#getArr").submit(function(){ var data = {'ab[]' : chosen}; $.post('cart/', data, function(response){ if(response == 'success'){ window.location.href="cart/" // references my views } else{ alert('Error!

Redirect to new page after receiving data from Javascript

亡梦爱人 提交于 2021-02-05 07:09:28
问题 I'm trying to pass a Javascript array to my Django views. This works, but I would like to manipulate that data and display it in a separate url. So I have a products page, where you select items. When the form is submitted, this javascript is called, and I want it to redirect to a cart page: $("#getArr").submit(function(){ var data = {'ab[]' : chosen}; $.post('cart/', data, function(response){ if(response == 'success'){ window.location.href="cart/" // references my views } else{ alert('Error!

Redirect to new page after receiving data from Javascript

我只是一个虾纸丫 提交于 2021-02-05 07:09:25
问题 I'm trying to pass a Javascript array to my Django views. This works, but I would like to manipulate that data and display it in a separate url. So I have a products page, where you select items. When the form is submitted, this javascript is called, and I want it to redirect to a cart page: $("#getArr").submit(function(){ var data = {'ab[]' : chosen}; $.post('cart/', data, function(response){ if(response == 'success'){ window.location.href="cart/" // references my views } else{ alert('Error!

Using non-standard attributes

拈花ヽ惹草 提交于 2021-02-05 07:09:24
问题 I am having trouble passing around values without using global variables when I am creating html/jquery applications. Quick example 1) Load a table with a class such as "playersTable" 2) Attach a unique ID such as "25" 3) Click on the table row and spawn a row of buttons that will perform actions based on the parent's class and ID; such as query playersTable WHERE row = 25, etc. The issue is that, as I am developing, I need to tie more and more values to the parent element (or any element

How to prevent a user from getting password field value in console

≯℡__Kan透↙ 提交于 2021-02-05 07:09:17
问题 I have been helping out some people with their computers and repairing them. One of these people asked me about the safety of storing passwords in the auto form field. I showed them a quick trick on how you can retrieve the password from a simple jQuery call in the console. While working on some websites, I have been trying to figure out a way of preventing the use of this trick to find out what the saved password is. To understand what im talking about if you dont know, try the following.