Posts by wDrik • 1,406 points
98 posts
-
1
votes1
answer74
viewsQ: Use reduce() method to reorder object array!
Personal have the following array of objects: old: [ { id: 1, date: '2020-08-27T00:00:00', title: 'Title 1', }, { id: 2, date: '2020-08-27T00:00:00', title: 'Title 2', }, { id: 3, date:…
javascriptasked wDrik 1,406 -
0
votes1
answer34
viewsQ: Is it possible to remove or change an html element and keep your kids with javascript?
I have the following structure. I would like to remove the div.son longer maintain the div.grandson, Is that possible?! or changing yours <tag> would also be a solution.. e.g. change…
-
2
votes2
answers179
viewsQ: What better way to check if an object is empty?
I have the following object: let obj = {}; If I try to validate obj.length return me a undefined, then I resorted to the Object.Keys alternative.. Object.keys(obj).length.. solved my problem.. but I…
javascriptasked wDrik 1,406 -
2
votes0
answers63
viewsQ: Is it possible to change the`key`of an object?
I have 1 array and 1 object: headers: [ { id: 1, title: 'tab-1' }, { id: 2, title: 'tab-2' }, { id: 3, title: 'tab-3' } ] contents: { 1: { id: 1, fields: [] }, 2: { id: 2, fields: [] }, 3: { id: 3,…
javascriptasked wDrik 1,406 -
2
votes1
answer30
viewsA: How to know if the MODEL value is a file?
You can check this using the instanceof! let bn_escudi_time = new File(['arr1', 'arr2', 'arr3'], "file.txt"); let string = 'string'; console.log(bn_escudi_time instanceof File); // -> true…
-
9
votes5
answers639
viewsQ: Complete number with "zeros" until the total size is 9!
I receive by parameter one Number.. ex: 18 and need to complement it with "zeros" until the total size is 9 numbers.. the result would be 180000000. If the value received is 678 for example, the…
-
1
votes0
answers22
viewsQ: Problem when referencing component in GSAP with Vuejs!
I am implementing an animation with GSAP in my project, when I use the ref in a common html tag works from good Ex: <div ref="element"></div> But when I do this on a Vuejs component it…
-
-1
votes1
answer102
viewsQ: How to keep part of a v-model(string) fixed in an input with Vuejs!
I have an input text with its respective model, but I need a part of this value to be fixed, for example: /static/download.jpg the idea is that the user can only change the text that is after…
-
8
votes2
answers100
viewsQ: Validate difference of 5 points for more or less
I need to make a validation if a value has a difference of up to 5, both for positive and negative. I wonder if there is any Javascript function that helps me in this, without having to do the…
javascriptasked wDrik 1,406 -
0
votes1
answer213
viewsQ: Is it possible to dynamically remove a directive with Vuejs?
I would like to know if it is possible to remove a directive dynamically with Vuejs Ex: <v-text-field v-mask="'XX:XX'" ></v-text-field> props: { mask: { type: String, default: '' } }…
-
2
votes1
answer51
viewsQ: Changing the default value of a parameter in a function is possible?
I have an array of functions, and I need to change the default value of the parameter with another value for each of them, in a loop.. Is that possible? Ex: var externalValidations = [ function…
-
1
votes0
answers192
viewsQ: Import external script file into Vue.js after build!
I have the following situation, I need to send only the build(dist) of a Vue project to the client, however he will need to create dynamic functions to validate some fields of a form, I have the…
-
1
votes1
answer99
viewsQ: Count of arrays inside an object!
I have an object with arrays inside, inside that array.. there are other objects! how can I know the total length of all arrays inside the first object! ex: let items = { 0: [ { foo: 'foo' }, { bar:…
-
2
votes1
answer308
viewsQ: Add more than one translation to Vue-i18n
Following the documentation of vue-i18n I managed to configure the translation in my application problem that I am stuck to only 2 languages, how can I add more translations? follows the current…
-
1
votes2
answers119
viewsA: Passing the "video index" of a playlist in a Youtube iframe
Brother, if you put it like that you’ll see it works.. the problem in your case is that the video with index = 1, is a private video or is broken and cannot be added to embed! <iframe…
-
2
votes2
answers106
viewsA: How to replace the value of a string from a certain character?
Alternative to previous response using Regex! let photo = 'photo.png'; console.log(photo.replace(/\..+/g, '')); Or: let photo = "photo.png"; let result = photo.split(".");…
-
0
votes2
answers369
viewsA: Flex vertical alignment
Brother, from what I understand this is what you need?! align-items: stretch; in .flex-start body{ background:black; } .flex-start { display: flex; align-items: stretch; } .wrap { flex-wrap: wrap; }…
-
0
votes2
answers130
viewsA: Node.js I cannot access a class property in class method
Brother a solution would be you pass projects as a parameter for the constructor, follow an example: class ProjectController { constructor(projects) { this.projects = projects; } store(req, res) {…
-
1
votes3
answers36
viewsA: Styling in menus
Brother you already have a "pub" class with it you can identify it in CSS! .pub { border-radius: 30px; border: 1px solid #FFF; color: #FFF; padding: 4px 12px; text-decoration: none; font-family:…
-
2
votes2
answers223
viewsQ: Merge an Object with an ES6 Javascript Object Array!
Staff I have the following variables! let content = { cd_empresa: 200, cd_produto: 13287, cd_status: 604, dt_validade: '2019-05-09T12:34:00', dv_possui_subvencao: 1, dv_regra: 1, fl_possui_item: 1,…
-
1
votes1
answer60
viewsQ: Merge 2 objects with Javascript ES6!
I have the following javascript objects.. headers: [ { text: 'Nome', value: 'nm_propriedade' }, { text: 'Área Segurada', value: 'nr_area_risco' }, { text: 'Início de plantio', value:…
-
0
votes2
answers85
viewsA: Text-align right, table
Use young flex-box! .result-battle:first-child { display: flex; justify-content: flex-end; }
-
0
votes3
answers4204
viewsA: Div exceeding Modal width limit
Brother.. puts in modal one overflow: hidden and on the table max-width: 100%, I believe this solves the problem.. however to avoid a scroll-side you will need to leave this table responsive!…
-
0
votes5
answers2441
viewsA: How to concatenate String within a repeat loop?
You can concatenate each loop with the operator .= $str = ''; for($c=0; $c < $tam; $c++){ $str .= $valor[$c] . ', '; } You’ll also need to remove the last comma substr(str, 0, -1);…
-
2
votes1
answer726
viewsQ: How to add Billing fields on Woocommerce’s Edit-Account page! (Wordpress)
Guys how can I add fields that are already default from Woocommerce on my account page? I tried this: but does not object to the expected outcome. add_action( 'woocommerce_edit_account_form',…
-
1
votes4
answers915
viewsA: Convert date format to php
Personal thanks to all I managed to settle as follows: $data_de_entrega = get_post_meta( $id_pedido, "Data de entrega", true ); $pt = [',', 'Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho',…
-
4
votes4
answers915
viewsQ: Convert date format to php
Personal I am working with Wordpress php and get from the database a date in the following format: "22 October, 2018", more need to convert it to "2018-10-22", how do I get that? tried:…
-
1
votes0
answers212
viewsQ: Doubts of ACL with Node.js!
People I am trying to apply Authorization (ACL) using the plugin npm "node_acl" in a Node.js application with express, I am trying to implement as explained in the documentation.. however I am…
-
0
votes0
answers122
viewsQ: Is it possible to resolve the No 'Access-Control-Allow-Origin' error on the front end?
Personal need to consume a third party API with Javascript, I do not have access to release Cors in the API.. and this error is appearing as I can solve ? I have the following request using Axios:…
-
0
votes0
answers47
viewsQ: Is it possible to run a script automatically when accessing a given URL?
I don’t have access to the code on this page, but I’d like to automate a task I run on a website every two hours.. I’ve developed a script for that, I play it on console and run it, so far so good..…
-
-1
votes1
answer151
viewsQ: Separates string into camelCase
It is possible using Javascript to convert string to camelCase, eg: areaEspacoReservado in Área espaço reservado Obs: add the accents where necessary ?
javascriptasked wDrik 1,406 -
0
votes1
answer428
viewsQ: Is there a standard for key naming of a JSON?
I am consuming a JSON, and I want to use the keys of this JSON as options of a select, but the nomenclature is in camelCase and without accents, ex: "destaques": [ { "fornecedoresCompany": [ {…
-
0
votes1
answer83
viewsQ: Load 4-in-4 items into a javascript loop
I’m making a request on an API that returns some events, however I only need to display 4 items first, and if a "See More" button is clicked.. 4 more items should appear at a time.. I have the…
-
1
votes1
answer239
viewsQ: Is it possible to use your phone camera in a Web App with React?
People need to develop a web app with React, "It’s not React Native", and it will be necessary to use the camera phone just to take a photo, is that possible with React? there are some lib for that?…
-
0
votes2
answers1751
viewsA: Send input value to modal
$('#myModal').on('show.bs.modal', function() { var nome = $("#txtNome").val(); $( '#texto' ).html( nome ); // Vc pode tentar assim.. $( '#texto' ).append( nome ); // Ou assim vai depender da sua…
-
2
votes1
answer91
viewsA: email by php using mail()
Here is a functional example of sending email with php via POST.. in this case I did the sending of the information via Ajax.. more vc can feel free to implement the front-end in any way you wish! I…
-
3
votes14
answers126839
viewsA: Phone Mask Using jQuery Mask Plugin
I had problems with most of the current answers.. I was able to make it work with the following script: jQuery('input.your-tel') .mask('(99) 99999-9999') .focusout(function (event) { let target,…
-
0
votes2
answers34
viewsA: answer in`json` received from a file `php`
You can try something like this: $("a#bloqDesbloq").on('click', function() { $.ajax({ method: 'POST', url: '../_requeridos/alteraAdministrador. dataType: 'json' }).then(function(data) {…
-
0
votes1
answer78
viewsA: Full mobile height menu
#sidebar { position:fixed; top:0px; right:0px; width:45%; display: block; height: 100% min-height:100%; background:#1a1a1a; text-align:center; transform-origin:right; transform:perspective(1200px)…
-
0
votes1
answer481
viewsQ: Is it possible to use contact form 7 with wordpress REST API?
Is it possible to use contact form 7 with wordpress REST API? Any references for reading or implementing? Thank you!
-
2
votes1
answer10860
viewsQ: How to use async / await in get request using Vue+Axios?
I have the following code and would like to know how I can implement a Try / catch with async / await running the same function: import Vue from 'vue' import axios from 'axios' new Vue({ el: '#app',…
-
0
votes1
answer140
viewsQ: Problems to render Vue.js main.js
I’m new to Vue and I need to maintain a project.. the problem is this: I have in main.js the route scheme.. main.js import Vue from 'vue' const app = new Vue({ el: '#app', data: { message: 'Hello…
-
2
votes1
answer132
viewsQ: What are the best practices for putting mongoDB into production?
I am studying Ode.js, and in most courses the staff uses mongoDB, I really enjoyed working with it, very simple and practical, but I have some questions: Nowadays, most hostels already support…
-
1
votes1
answer3134
viewsQ: Which password encryption should I use with Node.js? which one is more secure?
I am taking a course of Node.js and in this the tutor uses md5 to encrypt the password.. more read in some articles that md5 ñ is very safe.. which is the most recommended to use with Node.js? Thank…
-
0
votes1
answer80
viewsA: Force Javascript keydown into Google Maps autocomplete input!
Resolved as follows! jQuery("#autocomplete").keypress(function (e) { e.cancelBubble = true; if (e.keyCode === 13 || e.keyCode === 9) { google.maps.event.trigger(e.target, "keydown", { keyCode: 40,…
-
0
votes1
answer80
viewsQ: Force Javascript keydown into Google Maps autocomplete input!
Folks I have the following precise problem that by clicking "Enter" on an input with Google Maps auto complete, then it press the down key to select a Google Maps option.. tried several ways but it…
-
-1
votes1
answer669
viewsQ: Customize Woocommerce Registration!
I have a project where I need to customize the Woocommerce registration form, it already has email and password. But I need to add the CNPJ field and validate if it is true and this information…
-
0
votes1
answer130
viewsQ: Move array item to last position!
People need to move an item from an array to the last position of it! First I ordered it in altabetica order, but an item needs to be the last on the list, how can I do this with PHP ? I have the…
-
0
votes1
answer141
viewsQ: Wordpress Advanced Custom Fields Pro How to Activate Google Maps
I am using the plugin "Advanced Custom Fields Pro" wordpress. I’m trying to use the Custom Wordpress Field, but the same asks the key to access the Google API, I already have the key but do not know…
-
0
votes0
answers209
viewsQ: Force the keypress enter or Submit form into form with JS, Geolocation!
Guys, I have the following problem to solve.. I’m using the google API to pick up the user’s current geolocation, but when you click on the icon that picks the geolocation the form is only submitted…