Posts by usuario • 1,396 points
92 posts
-
0
votes2
answers47
viewsA: Find sequence in integer value
If the vector parameter is not array it will be converted to array function sequenceSearch(vector) { vector = Array.isArray(vector) ? vector : vector.toString().split('').map(Number); let pos = 0;…
-
1
votes1
answer57
viewsQ: Help with PHP session
Good morning! I have a php system where I use a webservice to perform queries, and save your return in the session to use via ajax. So far so good, the problem is when I need to make two or more…
-
0
votes1
answer36
viewsA: ID Undefined in Auth.currentUserInfo() aws-sdk function
I managed to enter the code: await (await Auth.currentCredentials()).getPromise(); before calling the Auth.currentUserInfo method(): async componentDidMount() { await (await…
-
1
votes2
answers92
viewsA: Check a file extension
Today there is a more current and functional alternative to find out if a given value belongs to an array. You can use the method Array.prototype.includes() of ES7. function run() { var receita =…
javascriptanswered usuario 1,396 -
-1
votes4
answers124
viewsA: Insert Parentheses between an acronym in the input field
Tries to put a replace to remove the ( ) function maiusculo(){ var quadro = document.getElementById("quadro").value; quadro = quadro.toUpperCase(); quadrocorrige= "("+ quadro.replace("(",…
-
1
votes2
answers497
viewsA: How to assign target="_Blank" to all external links after ajax has finished loading?
You can try adding the attribute target at the links: $("body, document").on("click", "a[href^='http']:not([href*='zaha.in'])", function(e){ $(this).attr("target", "_blank"); }); This way it will…
-
2
votes1
answer177
viewsA: Enable select by selecting with jQuery
Try to use the $(...).on("change", ...): $(document).ready(function() { $('select#select1').on('change', function() { $('select#select2').prop('disabled', false); }); }); <script…
-
4
votes2
answers1771
viewsA: Logic for grouping data in javascript array
var object = [ { data: 1, categories: "Branca", name: "Feminino" }, { data: 1, categories: "Parda", name: "Masculino" }, { data: 2, categories:…
-
5
votes1
answer1207
viewsA: How to concatenate variable names in Java
This is not possible. There are no dynamic variables in Java. Java variables need to be declared in source code. The closest result you can achieve and using ArrayList, String[] or a Map. Like:…
-
1
votes1
answer56
viewsQ: I can’t get the domain name with php
I am facing a problem that is to get the domain name of my website. I tried the code: define('PROTOCOL', 'http://'); define('DOMAIN', (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ''));…
-
0
votes1
answer34
viewsQ: How to do an sql query in Moongodb with php?
How do the following query sql in Mongo? select * from myDB WHERE nm_pesquisa LIKE "%SAO%" AND tp_m = "A" OR tp_m = "H"; I tried it this way but without success: $query = [ 'nm_pesquisa' =>…
-
1
votes1
answer176
viewsQ: Group json with PHP?
How do I group a json according to a field? I have the following json: { "origem": [ { "id": 154826, "nm": "", "tp": "", "am": "", "sg": "SAO", "sq": 925 }, { "id": 2289, "nm": "", "tp": "", "am":…
-
1
votes1
answer97
viewsQ: Help with Mongodb
I have a problem using the .find() mongoDB with Regexp. I have the following command: db.collection.find({"city": /SAOPAULO/}) When I do: db.collection.find({"city": /SAO/}) it searches on time, but…
-
0
votes1
answer48
viewsQ: Help with PHP and Mongodb
Hello. I have an application using PHP and Mongodb and wanted to know if there is any way to keep the connection with mongoDB open. I have the following code that connects to Mongo: private static…
-
0
votes0
answers80
viewsQ: Help with jQuery UI slide ranger
I have a slider ranger jQuery ui it works normal but the problem is that when I’m on mobile(by mobile) I can’t drag the slide so it works have to click on top. $(function() {…
-
0
votes2
answers142
viewsQ: How to add two li in a ul dynamically with jQuery?
html: <ul> <li>1</li> <li>2</li> Adicionar aqui <li>5</li> </ul> I need to add two li where it is written: "Add here". Does anyone know how to do this…
-
1
votes0
answers205
viewsQ: Help with Curl PHP
I have a requisition cURL and generally the WebService that conecto takes 8 seconds to return a JSON 600,000 lines. The problem is when I open a tab to make this request ex:…
-
0
votes2
answers76
viewsA: Auto insert string text
You can try like this: var input = document.getElementById("procurar-field"); var palavras = ["Lata", "Vidro", "Papel", "Terra"]; function inserePalavras(index) { if (index < palavras.length) {…
javascriptanswered usuario 1,396 -
2
votes1
answer127
viewsA: How to change html data-start-height by Media Queries?
Can you try: $(window).resize(function(){ if ($(window).width() <= 800){ $(".main-slider").attr("data-start-height", 500); }else if($(window).width() <= 600){…
-
0
votes2
answers604
viewsA: I can’t connect PHP to SQL Server 2014
Maybe you should try PDO with the Sqlsrv plugin (this is what I’m using to connect to my other boss’s software that uses the SQL Server 2014 database): $connection = new PDO("sqlsrv:Server=" .…
-
3
votes3
answers2288
viewsQ: How do I open a floating div tooltip style by clicking an input?
Hello. I got a problem I can’t fix. I have a text input and I needed when I clicked on it to open a window or floating div underneath it like a tooltip but with HTML inside it. How can I make that…
-
0
votes4
answers440
viewsA: Multiple ajax requests using jquery
Function: function funcaoAjax(type, url, dateType, beforesend, success, complete, error){ $.ajax({ type: type, url: url, dataType: dateType, beforeSend: beforesend, success: success, complete:…
-
0
votes3
answers823
viewsA: Onclick works only in the second click
When you try to check with a if if document.getElementById("div").style.opacity and equal to 0 will return undefined because there won’t be anything in the beginning to solve this you just need to…
javascript-eventsanswered usuario 1,396 -
0
votes1
answer46
viewsA: i want to get the keyup done in a div contenteditable
I got Keycode with var code = e.keyCode || e.which; $('#mesg').on('keyup', function(e){ var code = e.keyCode || e.which; if (code == 13) { // Resto do código alert("Enviando..."); // Resto do código…
-
4
votes1
answer2248
viewsA: How to validate if the date is larger than the other?
function validaDatas(){ var dataInicial = new Date($("input[name='datainicial']").val()); var dataFinal = new…
-
3
votes2
answers229
viewsA: Validation of javascript / jquery object?
What you want to use is property .length indicating the number of elements in the jQuery object. if ($("#idDiv) { console.log("existe"); } jQuery always returns an object. Be a selector, an array,…
-
2
votes4
answers6294
viewsA: Mask with Jquery changing from fixed to mobile or vice versa
You can do it like this: $("input.telefone").focusout(function() { var phone, element; element = $(this); element.unmask(); phone = element.val().replace(/\D/g, ''); if (phone.length > 10) {…
-
6
votes1
answer183
viewsA: Pure Javascript Portfolio Filter
I’ll give you some examples all with CSS unused Javascript. Follow the examples: Example 1: Link: Jsfiddle or Codepen *To test the Example 1 right here: /* CSS reset */…
javascriptanswered usuario 1,396 -
0
votes1
answer487
viewsA: Handle Cache with Jquery
Using the localStorage The localStorage saves data on the visitor’s computer, which are linked to (and only accessible by) their domain. And to use is very simple: // Cria um item "usuario" com…
-
1
votes2
answers446
viewsA: PHP in Browser Write , Read and Update . txt , Locally
I’ll try to explain half on top. I hope you understand: To Save the Data: <script> localStorage.setItem('strGuarda01', '<?php echo $strGuarda01;?>'); localStorage.setItem('strGuarda02',…
-
0
votes0
answers85
viewsQ: Java EE server error on Jboss server
Hello. I did a project in Netbeans on a computer and it works fine, but when I try to run the same project on another computer it returns this error: Implantando…
-
0
votes2
answers929
viewsA: Difference between Arrays
Try it this way: var listaLeituras= [12,13,14,15,16,17,18]; var leiturasRealizadas = [12,15,18]; var leiturasIgnoradas = listaLeituras.filter(function(item) { return !~$.inArray(item,…
javascriptanswered usuario 1,396 -
0
votes0
answers89
views -
1
votes1
answer92
viewsA: How do I search on an external website?
To consult in SERASA you need to integrate with this webserver: https://www.soawebservices.com.br/integracao/manuais/default.aspx
-
4
votes1
answer435
viewsA: Preloader with Materialize
Try it this way: Displays your Download with the beforeSend: and removes it as the complete: $.ajax({ type: 'post', url: 'proc_pedidos.php', data: $('form').serialize(), success: function (result) {…
-
2
votes0
answers88
viewsQ: Problem with jQuery filter?
I have this filter in jQuery: var aeroportosida = []; Filtro.prototype.filtroAereoNomeIda = function(value){ var dataa = JSON.parse(JSON.stringify(this.data)); aeroportosida = []; if(value.length ==…
-
1
votes1
answer70
viewsA: Generate table content through click action
Set an id for each tower in <tr> and then print them for the value of input. $(".torre").on('click', function(event){ var torre = $(this).find('input').val(); $('#tabela-patch tbody…
-
4
votes4
answers211
viewsQ: Like a tag on a table element with jQuery?
I have a simple table: table { border-collapse: collapse; } table tr td { border: 1px solid #000; } mark { background: yellow; } <table width="300px" border="1px" bordercolor="#FF0000">…
-
1
votes2
answers851
viewsA: Database connection - PDO
charset In versions prior to PHP 5.3.6, this element was ignored from silent form. The same behavior may be partially replicated with PDO::MYSQL_ATTR_INIT_COMMAND option, as well as example below…
-
0
votes1
answer783
viewsQ: Multiple filters on a json object?
Hello. I have 10 filters for a single json object: var filtro1 = function(value, selecionado){ var data = JSON.parse(JSON.stringify(json.aPesquisa)); var result = data.filter(function(pesquisa){ ...…
-
2
votes2
answers1768
viewsA: How to take angular typed data and save to an object array?
That’s the way you wanted it? angular.module("myApp", []) .controller("myCtrl", function($scope) { $scope.myClick = function() { let objeto = new Object(); objeto.nome = $scope.Nome; objeto.email =…
-
1
votes2
answers95
viewsA: Page does not recognize href=" "as if there was no href=" ", nothing happens - PHP
Change the.css template css for this one: body { padding: 0px; margin: 0px; width: 100%; background: #f9f9f9; /* Old browsers */ background:…
-
0
votes2
answers531
viewsA: How to Drag and Drop button in a textarea?
I don’t know if this is how you wanted it. And just drag the text to the textarea Note: I didn’t use one button in this example but only add Jsfiddle Note: In this example I used Jquery UI:…
-
0
votes3
answers1664
viewsA: How to use a Global variable in two Jquery codes to perform conditions?
And just remove the var of the variable usuario_ok in that part: if (c_nome.length > 2) { var usuario_ok = true; } else { var usuario_ok = false; } If you use var you will be re-declaring the…
-
2
votes1
answer226
viewsA: How to change cover photo
To update the image in real time you can try this way: function showThumbnail(filess) { var url = filess.value; var ext = url.substring(url.lastIndexOf('.') + 1).toLowerCase(); if (filess.files…
-
2
votes1
answer236
viewsA: Store values temporarily in text fields (inputs)
See if it helps you: var Campos = {}; Campos.add = function(i){ while (i--) { Campos.container = $(".inputs"); var qnt = Campos.container.find('section').length; var html = ''; html +=…
-
4
votes1
answer104
viewsA: Insert automatic link in hashtags
If the target is just the common English accents, it’s easy to list them one by one. I would do a regex with the following blocks: A-Za-z upper and lower case without accent áàâãéèêíïóôõöúçñ:…
-
1
votes4
answers1021
viewsA: Balloon that brings information about the page
An example you can use for a tooltip and Javascript Tooltip var tooltipOptions= { showDelay: 20, hideDelay: 300, effect: "fade", duration: 300, relativeTo: "element", position: 2, smartPosition:…
-
0
votes1
answer70
viewsQ: Problem with JSON filter and Array
I’m trying to filter a JSON with category but I’m not getting it. I have 3 checkbox and when I select them I should filter a json as selected. and when unchecking a checkbox should filter only those…
-
0
votes1
answer312
viewsA: Full Slide Bootstrap
Your slider does not occupy the whole area because it is inside a divwith a class="container" which does not allow him to occupy the entire area. <!DOCTYPE html> <html> <head>…