Questions tagged as 'javascript'

2
answers

Only allow to select two days ahead

I would like a javascript function that would allow me to select only two days ahead of the current one. example: today is 06/28/2018 it allows me to select from day 3, because it would count day 29/06 as 1st day, would skip weekend and would co...
asked by 29.06.2018 / 00:18
2
answers

Regex to replace commas and spaces together

I have the text in the string below: string = "ele, joao gosta de maria, mas maria gosta de jose"; string = string.replace(/???/g,", "); See that some words have more or less spaces between them, and may still have commas...
asked by 01.04.2018 / 01:40
3
answers

Automatic scroll to the right

Is there any way in jquery of when to click a button on the page or a div to do a small scroll automatically?     
asked by 22.10.2015 / 17:42
2
answers

Hide Div Jquery

How can I do if there is value to display a none in all divs with car? <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script><script>$(document).ready(function(){$(".acionador").click(function() { if...
asked by 27.04.2018 / 21:10
3
answers

Enable and disable an event without deleting and re-creating the event

Is there any way to disable and enable an existing event on an object? Example, I have an event in an element <img onclick="foo();"> On this same page, there is an action where, while running, you need to prevent the user from...
asked by 21.08.2015 / 10:30
2
answers

Set model property in javascript variable

I have an Action Usuario that displays user details among other actions that can be performed. I also have a javascript code that needs to part of setting a model property in the javascript variable. Here is the code below: @mode...
asked by 23.07.2015 / 20:44
1
answer

How to execute a javascript using href? [closed]

I would like to run javascript down using href . But by clicking on the supposed Log Out link, nothing happens. If I keep the cursor on the link it shows me the destination as javascript:logout() function logout() { var ch...
asked by 28.08.2015 / 22:11
2
answers

how to use bind, call or apply in this context?

function Contador () { this.num = 0; var obj = this; this.timer = setInterval (function add () { obj.num++; console.log (obj.num); }, 1000); } var b = new Contador(); I can not understand right how to use these functi...
asked by 24.01.2018 / 22:48
2
answers

Write each step of calculating a factorial

I have a piece of code that calculates the factorial of a number in JavaScript, but I wanted it to return the steps of each calculation, eg:    3! = 1x2x3 = 6 Follow the code I made. I tried to "print" decrementing the variable, but I'm n...
asked by 31.05.2018 / 06:10
4
answers

Add links to words in a text

On an html page how do the words in the text be converted into links? so that by clicking on a certain word, open the google translate page with the translation of the word. For example, in this sentence: "The universe is to everyone" If...
asked by 19.07.2018 / 22:07