Questions tagged as 'jquery'

2
answers

enable input button

The code I have to validate the button does not work: $(document).ready(function(){ $("#sendCat").prop('disabled', true); if ($('#cat').val()!= "") { $("#sendCat").prop('disabled', false); } }); <form action="proc...
asked by 20.03.2017 / 20:15
2
answers

Button that scrolls the page up without reaching the top

I have a code that scrolls the page to the top, but I do not want it to reach scrollTop = 0. It is possible that by clicking the button, it just slightly raises the page up, as if I had the keyboard above the keyboard? $(document).ready(fu...
asked by 04.10.2018 / 18:07
1
answer

Foreach jquery concatenate in table

I have an AJAX that in success brings a response : $(response).each(function(i) { alert(response[i]); $('#tbody').html( "<tr>" + "<td>" + response[i].id + "</td>" + "<td>" + respo...
asked by 31.10.2018 / 14:41
2
answers

Can you declare a JavaScript variable so that it always has 2 decimal places?

The idea is not to have to convert the result to two decimal places at all times. Example: var preco = 10.00 To show these decimal places, I have to put it like this: $("#preco").html("R$ " + preco.toFixed(2)); And then if I do any cal...
asked by 07.11.2018 / 22:34
1
answer

jQuery / javascript - Skip input when maxlength is reached

Good morning, friends! Next, I want to make a function that if it reaches the maxlength of the input (in the case 2 characters), it jumps to the next input. I made the code below that is not running ... var inputZin = $('.idade-viajante...
asked by 06.11.2018 / 13:44
3
answers

Prevent a value from being selected in the dropdown

Is there any way to prevent a value from being selected in a dropdown? For example: document.getElementById('teste').onchange = function (event){ var valor = this.value; if(valor == 4){ alert('esse valor não pode!'); event....
asked by 05.10.2017 / 22:07
2
answers

Why is not the selected select option being cleaned using Choosen?

I was trying to clear the selected option from the - <select> check box using JavaScript. In this checkbox I'm using the Choosen plugin. I saw an answer in the Stack Overflow , and I already made the following code: $("#btnL...
asked by 28.09.2017 / 21:40
2
answers

ScrollTop does not work after some scrolling

I have a div called search , I want that after ScrollTop 100 , it stays fixed. Not working. var $w = $(window); $w.on("scroll", function(){ if( $w.scrollTop() > 100 ) { $('busca').css("position", "fixed"); }...
asked by 10.04.2018 / 19:14
4
answers

Toggle header colors, based on menu hover

I have a traditional header, with a logo and links menu, I would like to switch the header colors based on the hover of each link in the menu. h1 { padding: 0; margin: 0; color: #fff } header { padding: 0; marg...
asked by 19.05.2018 / 15:25
1
answer

String Validations

I've been researching how to validate e-mail, dates, hours, etc. And in the case of email, I found a code like this: /^.+@.+\..{2,}$/; . He is incomplete. But I wanted to understand what these symbols are, and what do they represent to val...
asked by 28.05.2016 / 04:39