Questions tagged as 'javascript'

1
answer

Round off installment values for the first installment

For example: venda de R$ 200,00 em 3x: parc 1: 66,67 parc 2: 66,67 parc 3: 66,67 In addition to not making the change easier, it would be charging a penny more. You would need a solution such as: parc 1: 68,00 parc 2: 66,00 parcl 3: 66...
asked by 20.01.2015 / 14:19
2
answers

How to maintain indentation and line breaks when saving a text file via javascript

I was able to find a script that saves a text file (client-side). link: link Doubt: let's say that I "printe" this in the text box and have it saved, like saving the file exactly like this: I would like to print to the file like this, w...
asked by 15.04.2015 / 21:37
2
answers

Add elements from an array to other arrays

I want to add 3 elements to each empty array preferably using the splice method with the proviso that when data1 has 3 elements it jumps to data2 and adds 3 elements and when data2 has 3 elements it jumps to data3 and adds to arr .length equals...
asked by 11.01.2015 / 23:38
2
answers

Format Javascript date, find day of the week?

I have the following problem. I have a data picker that gives me the value of the date like this: dd-mm-aaa (05-13-2016) But I need to check which day of the week is ex: Today is Friday. The problem I can not check with this format. I w...
asked by 13.05.2016 / 18:11
4
answers

___ ___ erkimt Show error message when entering phone ______ qstntxt ___

I have a form and I need this field

%pre%

In case it is the phone, it will display the following error messages: If the user types less than 8 digits, an error message appears, a %code% .

If the user types "-" which is an invalid character, an alert with = %code%

And if the number is valid (8 digits) nothing appears.

My code:

%pre%

It's not working.

The reference in the HTML to the javascript has to be by onKeyup if possible, as the javascript has to check after the user types.

Sincerely,

Gabriel

    
______ azszpr127718 ___

I suggest using the validation supported by the browser itself. This only works if the browser supports HTML5

%pre%

To use something more complete or different you can continue to use the onchange event with this automatic validation:

%pre%
    
______ azszpr127721 ___

You can do this:

%pre% %pre%

Remembering that it is more practical to limit size by html using maxLength, and using onblur prevents it from showing the message at all times when typing.

    
______ azszpr127729 ___

To complement, I'll leave a more complete version of @GabrielRodrigues' answer.

I made using the jQuery Mask Plugin , I believe it increases the usability of the field since it already comes formatted, in addition it it also "prohibits" any letters or any non-digit characters from being typed.

%pre% %pre%
    
______ azszpr127738 ___

I got it! I used the answer from @Bruno Costa and Js from @Gabriel Rodrigues. It just looks like this:

%pre%     
___

I have a form and I need this field <label class="labVal210Esq">Telefone: <input type="text" class="val120Dir" name="TxtTelefone" /> </label> In case it is the phone, it will display the following error messages: If the us...
asked by 10.05.2016 / 15:07
2
answers

How to avoid conflicts in jquery libraries?

Good, I'll try to explain then I'm newbie . I need to use a new library, and This code works perfectly when alone with this example: < script src="//code.jquery.com/jquery-1.10.2.js">< /script > <script> meu codigo <...
asked by 20.05.2016 / 01:55
1
answer

How to call a function right after a slide effect?

I need to get the height of a div and re-think an ifram according to the current height, so far so good. I'm just picking up the height right after a click that gives a slideToggle in this div. And it seems to me that as yet the slide effect...
asked by 29.12.2014 / 17:23
2
answers

Reload image in Chrome

I've created a plugin to crop images through javascript and PHP, but I'm having trouble revealing the edited image after the success of the crop in ajax . I already researched the subject and found a trick that works for most of the main b...
asked by 05.01.2015 / 13:05
1
answer

HTML "script" tags receive exclusive "thread" for each one in the browser?

If separating JavaScript processes into tags <SCRIPT> are worth for individual processing of each schedule, or does the browser put everything together in a single process? Does anyone who really understands operating system an...
asked by 30.12.2014 / 12:13
1
answer

Increase size of a DIV manually

I have a div with a list of items inside, I would like to know how I make a function so that when the user clicks another div below the list, he can resize the height of this div manually Stack Overflow has this system, when...
asked by 12.12.2014 / 14:03