Questions tagged as 'javascript'

2
answers

Add values with jquery, string to number

I'm trying to add some values but instead of a sum result I'm getting the concatenated values, follow the example: var a = 7.5 var b = 1.00 var c = 2.0 var d = a+b+c console.log(d) = 7.51.00.2.0 But I wanted to get the followi...
asked by 23.05.2017 / 15:07
2
answers

Insert javascript in jQuery

Why not put javascript in jQuery? If I put it in "straight line" it works, if I put it indented, to make it easier to edit later, it no longer works. Why? WITHOUT FORMATTING, IT WORKS: $j('<div class="filters"> <div class="title t...
asked by 24.05.2017 / 16:08
2
answers

How to know when an element is at the top of the page

I'm developing a one page website with several sections (about, contact, services for example) And a fixed menu, the idea is as the user scrolls the page the fixed menu would change the active links, ie when in the contact section, in the fix...
asked by 25.05.2017 / 13:51
1
answer

Problem with mouse over image

I'd like to know how I can move my menu into an image I've made. I wanted to put the menu on the left side for example. Here's my menu: link Here is my code: <!-- Icon --> <div id="user"> <img id="icon" align="l...
asked by 04.01.2017 / 10:26
2
answers

JavaScript function that completes the field with leading zeros [duplicate]

I have a field that accepts 4 digits, I would like, after completing the field, when changing to another field, if the 4 digits are not entered, the field is auto-completed with leading zeros. What would a JavaScript function look like? And...
asked by 06.01.2017 / 12:51
1
answer

javascript function is giving error [closed]

This function is not being called and is giving error. It does not say exactly the error, but it gives error soon to enter the form: function ChangeSituacao(){ var vRads = document.getElementsByName('ind_situacao'); for(var i =...
asked by 05.01.2017 / 12:22
2
answers

How to perform an internal search by id?

How can I find out if a given element exists, via field input ? Example <html> <body> <input type="text" id="txt"><input type="button" value="mais" onclick="busca()"> <pre>Ex.: vaca, boi, p...
asked by 16.02.2017 / 18:39
1
answer

How to display message in AngularJS? [closed]

I'm working with angular and need to add a message on the screen when pressing the check code button. An error message or success. Angle Controller angular.module().controller(){ vm.validarProtocolo = function(){...
asked by 09.02.2017 / 19:06
2
answers

How to allow a regular expression of letters and numbers to accept the cedilla

I need the regular expression to accept the ç key. $('[name="txtEndereco"]').keyup(function () { this.value = this.value.replace(/[^a-zA-Z 0-9]+/g,''); });     
asked by 14.02.2017 / 22:12
3
answers

Validate an HTML form with JAVASCRIPT

What would be a way to validate the text field as soon as the button is clicked? Using only JavaScript . Ex :    If the field is not filled in , and the user clicks the button, it issues an alert and would not let the form be sent...
asked by 04.12.2017 / 17:22