Posts by JuniorNunes • 4,886 points
146 posts
-
1
votes1
answer158
viewsA: Xcode 11.2 deprecated, no longer publishes App
You can find through this link: https://developer.apple.com/download/ Or Download directly through this link:…
xcodeanswered JuniorNunes 4,886 -
3
votes1
answer102
viewsA: Is there any way to reduce the if’s of my code?
Have how you use ternary operator, follow the example: function updateUser($usuario, $senha, $adm){ //Atualiza informações sobre o usuário $q_senha = (!empty($senha)) ? "senha=md5('$senha')" : "";…
-
1
votes1
answer1436
viewsA: How to parameterize a route in the Vue?
You need to specify the parameter name in the route declaration: { path: '/editar/:id', name: 'editar', component: Vue.component('home-page') } And to get the received parameter $route.params.id or…
-
2
votes1
answer31
viewsA: Add comma to php
You can do it like this: echo preg_replace('/^(..)/', '$1,', '2098'); // 20,98 You can read more about preg_replace here. And regular expressions here.…
phpanswered JuniorNunes 4,886 -
1
votes1
answer185
viewsA: Regular expression capturing every line
You can do it like this: ^palavra.+ Where word is the beginning of the line you want to pick up. Example: https://regex101.com/r/LV4gzk/1…
regexanswered JuniorNunes 4,886 -
1
votes3
answers159
viewsA: Read values from a Json structure using Jquery
You’ll be able to access it like this: console.log(data['clientes'][0]['nmEntidade']);
-
2
votes3
answers929
viewsA: How to build JSON with a list of stores separated by categories?
You can also use the category name as key: var ljs = { "Categ 1": { "lojas": [ { nome: "LOJA A", piso: "1", tel: "", desc: "descrição da loja.", imagem: "logo_a.jpg" }, { nome: "LOJA B", piso: "1",…
-
4
votes3
answers929
viewsA: How to build JSON with a list of stores separated by categories?
A simple way would be like this: var ljs = [ { "categ": "Categ1", "lojas": [ { nome: "LOJA A", piso: "1", tel: "", desc: "descrição da loja.", imagem: "logo_a.jpg" }, { nome: "LOJA B", piso: "1",…
-
1
votes3
answers127
viewsA: (Pure js) function that Filtre array so that it returns single arrays with distinct elements
I think that solves your problem: var list =[ [3,4,7,9,4],[3,4,7,9,5],[3,4,7,9,6],[3,4,7,9,7], [3,4,7,9,8],[3,4,7,9,9],[3,4,8,3,3],[3,4,8,3,4], [3,4,8,3,5],[3,4,8,3,6],[3,4,8,3,7],[3,4,8,3,8],…
-
0
votes3
answers41
viewsA: Property and Object Javascript
The example is working: objetoSelecionado = document.selectForm.variosDias; console.log(objetoSelecionado) objetoSelecionado.remove() <form name="selectForm"> <select name="variosDias"…
-
1
votes3
answers288
viewsA: Search for tuple in an array
See if that helps you: a = [('FI', 'SE'), ('SE', 'DK'), ('DK', 'DE'), ('DE', 'PL'), ('PL', 'BY')] b = [['NL', 'DK', 0], ['NL', 'DE', 0], ['NL', 'BE', 0], ['FI', 'SE', 0.054]] result = [] for x in a:…
-
0
votes1
answer108
viewsA: Replace text with JS in a given URL
You can use the replace let url = 'https://meusite.com.br/arquivos/ids/785837-90-90/arquivo' let newUrl = url.replace(/90/g, '160') console.log(newUrl)…
javascriptanswered JuniorNunes 4,886 -
6
votes2
answers902
viewsA: How to delete all jpg files inside a PHP folder
You can do it like this: array_map('unlink', glob("caminho/completo/*.JPG")); The glob will return an array of all possible paths (referring to the . JPG files inside the specified folder). The…
phpanswered JuniorNunes 4,886 -
1
votes2
answers972
viewsA: Run "Send File" without having to click the input file
You can do it like this: $('i.icone-img').click(() => { $('[name="img_input"]').click(); }) input[type="file"] { display: none; } <script…
-
2
votes1
answer243
viewsA: Scroll according to clicked element
You can do it like this: $('[href^="#alvo"]').click(function(event) { event.preventDefault(); let target = this.getAttribute("href") $('html, body').animate({ scrollTop: $(target).offset().top},…
-
2
votes1
answer65
viewsA: Watch duration of a Youtube video?
Within the variable $ytarr has the index length_seconds that brings the duration of the video in seconds: $seconds = $ytarr['length_seconds'];…
-
1
votes1
answer2542
viewsA: How to access Vue-Router dynamic route parameter
You can access the route parameters through the $route, thus: mounted() { console.log(this.$route.params.dia); console.log(this.$route.params.hora); console.log('Component mounted.') }, It is…
-
2
votes1
answer43
viewsA: Which combo was selected within a form
You can do that: $('select[name^=combo]').change(function() { console.log('select:', this.name) console.log('valor selecionado:', this.value) }) <script…
-
0
votes1
answer169
viewsA: Error in PHP image upload
Add the enctype in your form: <form id="cadastro" name="cadastro" method="post" enctype="multipart/form-data"> Read more here and here.…
file-uploadanswered JuniorNunes 4,886 -
1
votes1
answer544
viewsA: Make a click fire another click after 1 second
Can add a setTimeout: $("#button1").click(function(){ setTimeout(function() { $("#button2").trigger('click'); }, 1000); }); $("#button2").click(function(){ $("#box").append('<p>Botao 2…
-
1
votes2
answers2849
viewsA: Remove all White Spaces from Textarea
Try it this way: $(function () { $('#texto').on('input', function () { var texto = $(this).val(); texto = texto.replace(/^\s+|\s+$/g,""); $('#convertido1').val(texto); }); }); <script…
-
1
votes1
answer38
viewsA: Help with deleting record
You are not passing the ID in the URL... Try this way: function excluir(id){ if(confirm("Deseja excluir o registro?")){ location.href = 'excluirFuncionario.php?id=' + id; } } <?php…
-
4
votes2
answers168
viewsA: Error in cpf mask
For your code you can try it like this: function mascCPF(texto) { if(event.keyCode != 8) { if(texto.length === 3 || texto.length === 7) { document.getElementById("cpf").value = texto + "."; } else…
-
1
votes1
answer1055
viewsA: Laravel Project does not recognize my Javascript file
The problem is that you are specifying an incorrect path within your file webpack.mix.js: Your file is like this: mix.js([ 'resources/assets/js/vue.js', 'resources/assets/js/axios.js',…
-
0
votes1
answer474
viewsA: How to give multiple python prints in the same place as the terminal?
I did some research and I managed to do it that way: import sys import time for x in range(101): print("{}%".format (x)) sys.stdout.write("\033[F") time.sleep(0.1) What causes the text to be…
-
1
votes4
answers59
viewsA: Click the div to open option
See if that’s what you want: $('li div.selectClick').click(function() { $(".div-select").slideDown('slow'); }) .div-select { width:215px; display: none; } .div-select select { background:…
jqueryanswered JuniorNunes 4,886 -
3
votes3
answers1676
viewsA: Check if there is a field inside Json
You can use the isset: // Decodifica o Json $obj = json_decode($json); if(isset($obj->operacao->nome)) { // O valor existe }…
phpanswered JuniorNunes 4,886 -
3
votes2
answers84
viewsA: Grouping of the Array?
If you always come to this structure, it solves: $arr = [ [''], ['Cor', 'Azul'], ['Peso', '100kg'], ['Espessura', '10cm'], [''], ['Cor', 'Azul'], [''], ['Cor', 'adg'], ['Peso', 'gadg'], [''],…
phpanswered JuniorNunes 4,886 -
1
votes2
answers1364
viewsA: Retrieve xml data with php
The answer format is a little strange, so I had to make a loop to show all the latitudes and longitudes. Try to do it this way: $xml = simplexml_load_file('url-do-xml'); $i = 1;…
-
1
votes3
answers372
viewsA: How to catch a class with Jquery array?
You can pick it up using the .get: console.log($('.benefits li').get(0)); console.log($('.benefits li').get(1)); console.log($('.benefits li').get(2)); <script…
-
0
votes1
answer543
viewsA: Show data from json
Just take out the athletes index since this information is coming at the root of json: $pontos = $jogadores['pontos']; $rodada = $jogadores['rodada_atual']; Jsonformatter is a good site for you to…
-
2
votes2
answers178
viewsA: How to make editable radiobutton?
You can do so too: function loadEditLabel() { // Salva o novo input saindo do campo ou apertando enter $('[contenteditable="true"]').focus().select().keydown(function(event) { if(event.key ==…
-
4
votes3
answers414
viewsA: How to remove specific word from string?
You can do it like this: let url = "https://google.com"; let novaUrl = url.replace(/^https?:\/\//, ''); console.log(novaUrl);…
-
0
votes1
answer271
viewsA: Hover in another image or background
You can do it like this: $('.blibli,.bloblo').on('mouseover', function() { $('.bleble').prop('src', 'https://blognumbers.files.wordpress.com/2010/09/4.jpg'); }); $('.blibli,.bloblo').on('mouseout',…
-
1
votes1
answer850
viewsA: Get the input value on the same page with PHP
Making ajax request to obtain the latitude and longitude of the zip code dynamically: $('#cep').keyup(function() { // Dispara a função quando um caracter é digitado if(this.value.length > 7) { //…
phpanswered JuniorNunes 4,886 -
2
votes3
answers64
viewsA: Grab piece of text in php
You can do it like this: $erro = "QLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry"; $estaContido = (strpos($erro, "1062") !== false); var_dump($estaContido); // true…
phpanswered JuniorNunes 4,886 -
0
votes3
answers902
viewsA: How to convert text field with mask to double
What’s happening is that the thousand separation point is being interpreted as decimal separator, just take it out before replacing the comma: $adiantamento = str_replace('.', '',…
-
1
votes3
answers181
viewsA: Enable contenteditable="false" tag for "true" with javascript
A different way would be: document.querySelector('.editar').onclick = function() { let label = (this.innerHTML == 'Editar' ? 'Salvar' : 'Editar'); let inEdit = (label == 'Salvar');…
-
0
votes3
answers1188
viewsA: How to pick a specific element between several of the same class via jquery?
Do it like this: let el = $('[value="texto3"]'); console.log(el.val()); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <input type = "text"…
-
5
votes3
answers2844
viewsA: Perform a function while holding button, stop when release
You can do it like this: var intervalId = 0; // Define o evento de clicar com o botão do mouse no #click $('#click').on('mousedown', function() { intervalId = setInterval(hold, 500); // Define um…
-
4
votes2
answers1403
viewsA: Pick value after point
Using explode you can do so: $valor = "235.33333333333333"; $s = explode('.' $valor); $result = $s[0] . '.' . substr($s[1], 0, 2); print_r($result); // 235.33 But I recommend you do with the…
phpanswered JuniorNunes 4,886 -
0
votes2
answers1288
viewsA: Turn string into integer in PHP
You’ll need to change your code a little bit: To make it work use these lines: require_once 'CalculaBeneficio.php'; $calcBeneficio = new CalculaBeneficio($_POST); $calcBeneficio->calcDias();…
-
1
votes2
answers497
viewsA: Show and search fields and according to selected checkbox field?
You can do it like this: Add data-label on your Ivs that will be displayed/hidden with the corresponding input value, example: <div class="form-group" style="margin: 0 auto;"…
-
1
votes2
answers51
viewsA: how to identify disable tag with jQuery
You can use the toggleClass also: $('.form_campos:disabled').toggleClass('form_campos'); .form_campos { height: 31px; width: 100%; color: #484848; align-self: flex-end; padding: 5px; outline: none;…
-
1
votes1
answer1411
viewsA: Add dynamic fields in jQuery
Do it like this: $('#add').click(function() { $('.fields').append('<input type="text" name="valor[]" id="valor" value="0" onkeyup="sum()" />'); }); function sum() { let total = 0; $('.fields…
jqueryanswered JuniorNunes 4,886 -
2
votes2
answers165
viewsA: How to select elements that have a valid id?
You can do it this way: var el = $('[id]:not([id=""])'); console.log(el.get()); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <section>…
jqueryanswered JuniorNunes 4,886 -
1
votes2
answers514
viewsA: How do I do a javascript updating form data?
Okay, let’s make some changes to your code: Add a data-Row property to the tag option echo "<option data-row='". json_encode($row) . "' value=".$row['evento_id'].">".$row['eventoNome']."…
-
0
votes1
answer157
viewsA: How to calculate the value of two inputs one of type range and other option and print result in real time?
You can do it like this: function generateResult() { result.innerHTML = +select.value * +range.value; }; generateResult(); document.querySelectorAll('.observe').forEach(function(element) {…
-
2
votes1
answer1671
viewsA: Shell Script for file and directory localization
I made some modifications to your code and it worked here: #!/bin/bash # localiza.sh # script para localizar arquivos e diretórios echo "Digite o nome do diretório: " read DIR echo "Digite o nome do…
-
2
votes1
answer51
viewsA: Recover all checked checkboxes
Put clasps on name of input: <input type="checkbox" class='marcar' name="seriais[]" value="<?=$linha['ordem_servico']; ?>" /> This way it will send an array with all the selected values,…