Posts by Mateus Veloso • 1,852 points
105 posts
-
0
votes2
answers737
viewsA: Perform function after given time you have stopped typing (keyup) Vuejs or Pure JS
I remade the answer with pure js. var tempo = null; document.getElementById('nome').addEventListener("keyup", teste); function teste(){ var v = document.getElementById('nome').value;…
-
2
votes1
answer511
viewsA: When clicking the button makes two ajax requests, how to avoid?
Put your code in a function : function teste(e){ preco = $(e).attr('id'); $.ajax({ url: path + 'Usuario/efetuarPagamento', type: 'POST', data: {preco: preco}, success: function (response) {…
-
0
votes1
answer229
viewsA: Field obligation
Functional example, anything post in the comments. $(function(){ $('input').on('focusout',function(){ if(this.value === ''){ $(this).css('border','1px solid red'); }else{ $(this).css('border',''); }…
-
2
votes3
answers5506
viewsA: Format string or float for currency
Functions with and without input. var mask = { money: function() { var el = this ,exec = function(v) { v = v.replace(/\D/g,""); v = new String(Number(v)); var len = v.length; if (1== len) v =…
-
1
votes2
answers161
viewsA: Increase width in % and not in px
Functional example using % taken from w3school If you need to in Ogress you can comment that I edit the reply. function move() { var elem = document.getElementById("myBar"); var width = 1; var id =…
-
0
votes1
answer381
viewsA: Add filtered values from an html table with jquery
Functional example. Explanation : Taking all the TR’s and checking which one is type 'X' and adding only those that meet the same. $(function(){ var total = 0; $('tr').each(function(){ var…
-
1
votes2
answers437
viewsA: Send form only if any input changes
Using sessionStorage to store the initial form, then only compare, it is worth mentioning the use of the serialize() of jQuery. $(function () { if (sessionStorage) { sessionStorage.setItem('form',…
-
2
votes4
answers5086
viewsA: How to add values of a column in the table?
I made a functional example where I put the Qtd class in the tds and took them all in each. I hope it helps $(function(){ var total = 0; $('.qtd').each(function(){ total +=…
-
0
votes2
answers365
viewsA: Losing cookie (created in javascript) when switching pages
A functional example, check if you can fix your problem by following the step by step. I did not identify an error in your script. Functional example…
-
1
votes2
answers4989
viewsA: What is a boolean?
Boolean* In computer science, boolean is a type of primitive data that has two values, which can be considered as 0 or 1, false or true.
-
3
votes4
answers2496
viewsA: Performance of COUNT(*) and COUNT(1)
The queries of Count(*) or Count(column or anything else), has no difference in performance levels, including was one of the topics covered in Gustavo Maia blog in the category "SQL Server Myths",…
-
0
votes3
answers64
viewsA: Delete part of a string and keep URL contained in it
I made 2 functional examples, use what you think best, there must be other ways only I did just these. var conteudo = '[caption id="attachment_42478" align="alignleft" width="640"] <img…
-
0
votes1
answer64
viewsA: Changing color of a div by clicking the first time and showing an alert by clicking the second time
Here is an example, if there are any questions put in the comment. $(function(){ $('div').click(function(){ console.log($(this).css('background-color')) if($(this).css('background-color') ==…
-
1
votes1
answer207
viewsA: replace color box by image in css
I made an example by placing image instead of color, see if it solves your problem, otherwise advise to edit the answer. #page1{ width: 200px; height: 200px; background: red; background-size: 200px;…
-
1
votes1
answer21
viewsA: Individualize Page Exchange Time
I changed the function by adding the var tempo, each position corresponds to the time position of the url, so you can modify it however you want. $(function () { var urls = [ "pagina1.php",…
-
2
votes2
answers190
viewsQ: Postgresql COUNT function does not work
The problem is simple but I can not understand where I am missing, I need to check the amount of results of the following sql: SELECT f.id,sum(p.valor) as valor_fatura, f.valor_desconto as desconto,…
-
12
votes3
answers1078
viewsA: What is the impact of changing the default behavior of an HTML element?
It is allowed to use Javascript to change the natural behavior of an element to act as another? Yes, from the moment we have to stop the spread and cancel a particular event (if it is cancellable,…
-
1
votes1
answer210
viewsA: JSON return with error: Syntaxerror: Missing ; before statement
The error is happening because you did not set a function to callback. I’ll give you an example of how you solve this. function teste(r){console.log(r);} var url =…
-
1
votes4
answers730
viewsA: Hover CSS affect another element
Example with CSS only. a{ display:none; } div:hover a{ display: block; } <div> Fulano <a href="#">LINK</a> </div>…
cssanswered Mateus Veloso 1,852 -
6
votes1
answer2894
viewsA: Can you cache/retrieve information using javascript/jquery?
With Html5 you can use localstorage = local storage. Explanation : What is local HTML storage? With local storage, web applications can store data locally in the user’s browser. Before HTML5, the…
-
-2
votes2
answers1314
viewsA: I need to add checkbox values (additional snacks)
With the script below you will check all checks marked, modify as you want. jQuery(document).ready(function(){ $('input[type=button]').click(function(){ $("input:checked").each(function() {…
javascriptanswered Mateus Veloso 1,852 -
3
votes1
answer308
viewsA: Change css by name / url (No ID or class)
Come on, from what I understand you need to first create the classes that will give life to everything, with the classes created now you need to check through the link and add to each 'job' your…
-
1
votes5
answers2126
viewsA: function to count Divs quantity
I set the code to count the Ivs and only fill in if it’s above 3. I take all Divs containing class’d' for count and modification. jQuery(document).ready(function(){ if(jQuery('.d').length > 3){…
-
0
votes1
answer115
viewsA: Trigger an event by pressing the 2x volume button?
Functional example below, modify it to suit your needs : Keypresstool : public class KeyPressTool { private static int doublePressSpeed = 300; // double keypressed in ms private static long…
-
2
votes2
answers123
viewsA: Is there any way to self-adjusting the site for mobile phones?
There is, you can even use some framework example: Bootstrap. I’ll leave an example below if you do not want to use any framework and do everything in 'hand' : /* Small devices ( @screen-sm-min…
-
2
votes3
answers2794
viewsA: Sum values of two inputs and show in third
Functional example, sum + sum = result. jQuery(document).ready(function(){ jQuery('input').on('keyup',function(){ if(jQuery(this).attr('name') === 'result'){ return false; } var soma1 =…
-
1
votes2
answers1418
viewsA: Buttons in Javascript
Answering your question, it leaves the page because you are using the window.location Explanation: The window.Location object can be used to get the address of the current page (URL) and to redirect…
-
1
votes2
answers144
viewsA: Enter call Button in Google Chrome and Firefox
Below is a functional example using jQuery. jQuery(document).ready(function(){ jQuery('#senha').on('keyup',function(e){ if(e.keyCode == '13'){ jQuery('#entrar').trigger('click'); } })…
-
1
votes2
answers68
viewsA: Height of div using float
Solved, just add float in the main div. div.gallery { margin: 5px; border: 1px solid #ccc; float: left; width: 180px; } div.gallery:hover { border: 1px solid #777; } div.gallery img { width: 100%;…
-
-1
votes3
answers5951
viewsA: Add inputs with jquery and real time
I made a simple and functional example, any doubt just comment. jQuery('input').on('keyup',function(){ var m = parseInt(jQuery('#multa').val() != '' ? jQuery('#multa').val() : 0); var j =…
-
3
votes2
answers189
viewsA: How to avoid repeating code that does the same thing for different Ids?
[Edited] I added the class. some and she is now responsible for adding visibility, so it is possible to always take the first element of this class and remove it. Any questions comment below.…
-
1
votes2
answers2339
viewsA: Clear selected option from a select with jQuery
If I understand your question correctly you want to reset your <select> if so I will create an example below. jQuery(document).ready(function(){ jQuery('#limpar').click(function(){…
-
0
votes2
answers860
viewsA: Local and Session Storage for Login and Registration
[ EDITED ] At the time I posted this example there was no code in the question, I will analyze to find flaws and help. Since you didn’t specify an error or something like that, I made a simple…
-
3
votes1
answer180
viewsA: Javascript - Focusout does not activate AJAX
There is an error in your if, some '{' were in wrong places, put it that way: if(amount > 0){ $.ajax({ url : SITE + 'addbudget', type: "POST", dataType: "JSON", data: { id:id, amount:amount,…
-
0
votes4
answers1937
viewsA: View data format en dd/mm/yyyy
You need to change the date format, there are several ways to do, below is a simple example. Change that : $('[name="txt_dt_vencimento"]').val(tbl_lancamento.dt_vencimento); for : var spDate =…
-
0
votes1
answer112
viewsA: Error while converting types
The problem is that there is a line break and when trying to convert to Integer with parse the error happens, a solution would be to add the . Trim() to remove this and function normally, thus :…
-
0
votes2
answers14723
viewsA: Set Iframe to 100% height
You need to add in html,body 100% css at the time for other elements to do this. html,body{ height: 100%; } <iframe src="https://answall.com" width="100%" height="100%" frameborder="0"…
-
3
votes1
answer51
viewsA: How to prefix value in input
According to what I understood regarding your question, I’ve drawn up this code see if this is what you wanted. jQuery(document).ready(function(){ jQuery('.inp-contato').on('keypress',function(){…
-
1
votes2
answers8760
viewsA: How to create a list with some attributes in java?
You need to do it this way. Avaliacaomensal.java will have this code: public class AvaliacaoMensal { private String questao; private char potencial; private int resultado; public String getQuestao()…
javaanswered Mateus Veloso 1,852 -
0
votes1
answer548
viewsA: Reading File in Java
Here is a basic and functional example, if you have any problem you can comment below. Don’t forget to pass the correct file path. try { BufferedReader br = new BufferedReader(new…
-
0
votes3
answers1068
viewsA: How to implement a "scroll Hijacking"
I created a simple and practical example: jQuery(document).ready(function() { jQuery('li').click(function(){ switch(jQuery(this).text().trim()){ case 'Vermelho': $('html, body').animate({ scrollTop:…
-
1
votes4
answers1118
viewsA: Select input with a certain class within a form
You can use the . serialize() of jQuery with this function you get all the data of your form correctly for sending. would look like this: jQuery('form').serialize(); Here an example of the code :…
-
0
votes1
answer813
viewsA: Click on button and open list
You can try it this way and see if it resolves. $(function() { $("#successBtn").click(function(){ $("#produtos").fadeIn(); }); }); Functional example. $(function() {…
-
1
votes1
answer201
viewsQ: Annotation or method to ignore field (Xstream 1.3.1)
I have a Circularreferenceexception problem when I try to do this: XStream xstream = new XStream(new JettisonMappedXmlDriver()); xstream.setMode(XStream.NO_REFERENCES); xstream.alias("resultList",…
-
-1
votes1
answer52
viewsQ: Error of Circularreferenceexception
I need help, I’m with this : com.thoughtworks.Xstream.core.Treemarshaller$Circularreferenceexception And I can’t find the solution. This is the excerpt from the code : XStream xstream = new…
javaasked Mateus Veloso 1,852 -
0
votes2
answers319
viewsA: Hide and show div using href
Your href will look like this: <a href="javascript:ocultarMostrarFiltros()" class="wminimize"> Now you need to have the function that makes the magic : First you check the current state ( if…
-
0
votes1
answer1369
viewsA: Uncaught Typeerror: Cannot read Property 'addeventlistener' of null
I suppose you’re trying to add an event to a null, for example: var overlay = document.querySelector( '.md-overlay' ); If there is no 'Md-overlay' just below you have this section :…
-
-2
votes1
answer882
viewsA: Decrease page size for printing
You can use: @media print, so you can specify the size, follow an example : JSFIDDLE EXAMPLE I hope I’ve helped!
-
5
votes11
answers38715
viewsA: How to check if the variable string value is number?
Check if it is int: def isInt(value): try: int(value) return True except: return False I hope I’ve helped!
-
1
votes1
answer49
viewsA: Merge upload and input ajax
To check if your input file has files you can use the following code: if(document.getElementById('avatar').files.length !== 0) {console.log('Existe arquivos');} I hope I’ve helped!…