Posts by LeAndrade • 8,475 points
404 posts
-
4
votes5
answers9207
viewsA: Change the color of the text by clicking a button
One way to use a button and swap the text of the div is to use the pseudo-element :target and place an element a inside the button and manipulate the div by your id: a{ text-decoration: none; color:…
-
1
votes1
answer507
viewsQ: How to install Node.js v.10 on Linux (16.04 LTS)
I’m following the documentation on the official website of Node for its installation in an environment Linux with Ubuntu distribution, which in turn redirects to this page on github demonstrating…
-
1
votes3
answers55
viewsA: Jquery.text does not work
So I don’t know what environment you’re testing, but, as you can see below, it’s working normally: var $horas = $('#horas'), $minutos = $('#minutos'), $segundos = $('#segundos'); function pegaHora()…
-
1
votes2
answers43
viewsA: Div doesn’t get 100% height
Yes, it is the expected, because the percentage acts on a fixed amount say so, then you are doing width: 100% nothing really. One of the ways you can use percentage in the daughters' Ivs is by…
-
2
votes2
answers124
viewsA: How to know how many times an object appeared in the array
You can reach the expected result using the method filter: let array1 = [ {nome: 'joao'}, {nome: 'maria'}, {nome: 'joao'}, {nome: 'carlos'}, {nome: 'joao'}, {nome: 'carlos'}, ]; let nomeJoao =…
-
0
votes1
answer580
viewsA: How to make a button type "button" perform a javascript function instead of performing Submit
So if the button’s not the type Submit there is no reason why the form should be sent, as you can see in the example. If you click the button with the image the form is not submitted and performs…
-
2
votes3
answers222
viewsA: Show div after a certain amount of input digits
There are many ways to do this, one of them is to put an event of input for when something is typed in the field show the list and already go filtering: $(document).ready(function() { var valor =…
-
3
votes1
answer52
viewsA: Can you fix this css please!
The problem there is that you are not closing the keys {}. Like you said it is CSS, there can be no elements within other elements, this way that is written, is only accepted in pre-processed CSS as…
-
0
votes1
answer47
viewsA: HELP WITH THE IONIC!
So you probably should have given one npm install -g ionic right? Doing this npm will always fetch the latest officially available updated version, in case there 4.12.0 for you to install a previous…
-
1
votes2
answers57
viewsA: The intention is to make these two <H4> titles editable, but unfortunately I am only able to apply in the first <H4>
Just for the record Html5 has the attribute contenteditable which make text elements editable: h4 { outline: none; } <div class="informativo"> <h1>Bom dia,</h1> <p> Prezado…
-
1
votes1
answer139
viewsA: Close menu by clicking link
I confess that I did not understand the relation of the codes posted along with the question and the question. A mixture of jQuery with Javascript, Anyway. But, if you want that when clicking on the…
-
1
votes2
answers117
viewsA: To add variable to a Jquery selector
Dude I think you got a little lost in the attributes of the elements at the time of making the code, and made confusion. You at the click of the button call a function that also has the same click…
-
1
votes1
answer50
viewsA: menu with Jquery tabs
You could not reach the expected result due to picking the wrong element in the method Closest() Instead of taking the tag ul and do the find(), have to catch the tag li: $('.j_open').on('click',…
-
0
votes1
answer35
viewsA: How to include buttons from another button in Jquery
I made an example that you can try to implement. I created a function Increments to increase the values of the código and also instead of using String used literals template to dry up the code:…
-
0
votes2
answers1534
viewsA: Convert a JSON to OBJECT with Angular
As you can see in the console outputs the type of this data is a object, you can easily know using the operator typeof. let dados = {"content": [ {"id": 1, "nomebd": "teste", "email":…
-
0
votes2
answers668
viewsA: How to use filters in vuejs for data collections?
Using the method filter, you filter the array and use your return the way you want: new Vue({ el: '#app', data: { search: 'Listar todos', certos: [], errados: [], mostrarCertos: true,…
-
1
votes1
answer127
viewsA: Grab the width of an image in VUE/JS
You can pick up the width and height of the images with the methods Javascript: naturalWidth() and naturalHeight returning the original image values. previewFiles_logo_login(e) { const file =…
-
7
votes3
answers1301
viewsA: How to catch the element where my cursor is?
If you are no longer using jQuery, you don’t need to load an entire library just for this, you can get the elements with pure Javascript: Clicking with the mouse document.body.onclick = function() {…
-
0
votes4
answers198
viewsA: More than one value for the same appendchild()
It follows a way to implement if I understand the question correctly: var li = document.createElement('LI'); // cria uma tag li var span1 = document.createElement('span'); // cria a primeira tag…
javascriptanswered LeAndrade 8,475 -
3
votes1
answer41
viewsA: Why did I have to add global research to this replace?
Who told you that the first didn’t work?? It did, if you count in your code you have 7 times the sequence ​ if you count after you executed without the g it did what expected is to…
-
1
votes3
answers812
viewsA: How to style results made with Javascript?
What happens there is that you overwrite every HTML page with Document.write, so it loses CSS formatting, there are many ways to do what it wants, one of them is to hide the form and show the result…
-
0
votes1
answer137
viewsA: How to disable button and enable only after selecting combos
You can do as in the example below. Basically you will use the method change() to see if select has been changed. With each change in select the variables return receives the value of true, then…
-
2
votes2
answers1300
viewsA: How to replace a string in Jquery or Javascript
To replace using replace(), just pass the value you want to be replaced by a new value or none, if you also want to remove the space that is at the beginning of the text you can use the method…
-
1
votes3
answers100
viewsA: Change position HTML element with each (or other hint) on page load
Just one more way to make it on record: $(function() { var cont_AA = $('.AA'); $('.item').each(function(i) { $('.item:eq('+i+')').append(cont_AA[i]); $('.AB:eq('+i+')').insertAfter(cont_AA[i]); });…
-
3
votes1
answer52
viewsA: Feedback on a drag drop
As you add a class to the cards, you only need to make a conditional to see if they have the classes. If the classes show the message to the user, otherwise the message is not shown. This way,…
-
0
votes1
answer640
viewsA: Changing content of a Vue component based on the URL
Flávio what you can do is, extract the id that is coming through the url through a computed properties with regex and in Html use v-for to traverse the object estampas and a v-if to make a condition…
-
1
votes2
answers136
viewsA: Javascript declare variables outside the function
This is a question of running order in Javascript. You can declare the variables outside and take the value inside the function and parse as shown: var x = document.getElementById('num1'); var y =…
-
1
votes2
answers91
viewsA: Display all elements on the screen
Just to leave registered on the site, if you want to do something similar to what you were doing you can create a tag div HTML and insert the values normally, just as already said in João’s reply,…
javascriptanswered LeAndrade 8,475 -
2
votes2
answers91
viewsA: Help with css animation!
I made an example just to demonstrate how it can be done using Javascript: var home = document.getElementById('HomePage'); var menu = document.getElementsByClassName('menu')[0]; menu.style.display =…
-
0
votes1
answer61
viewsA: print the same variable in two different places
As has been said you are repeating ids is this a bad practice, you can put instead of id a class for the elements and take the value by its index: var cliente = document.getElementById('nome'); var…
javascriptanswered LeAndrade 8,475 -
2
votes3
answers1328
viewsA: how to check the <input type=date> in js?
This is quite simple, in a basic way you can pick up if the field is empty using a if and treat the message to each event of Blur in the field: let valor = document.getElementById('nasc');…
-
1
votes1
answer61
viewsA: Filter to select content
I made a very basic example following your example using jQuery, basically what you do is every change in select he shows the card according to the value of the select: $(function() { let filtro =…
-
1
votes1
answer158
viewsA: Make editable post-it (element)
You don’t even need Javascript for this, you can do only with the attribute contenteditable of HTML5: .post-it { width: 50%; height: 200px; background-color: #ffffcb; padding: 15px; } h1 {…
-
1
votes1
answer230
viewsA: Play son using html and javascript with an audio file array
Good André, I don’t understand very well how the flow of playing the audio will be when you click the button, but if you want to assign a src the tag audio through a Javascript array, you just…
javascriptanswered LeAndrade 8,475 -
1
votes2
answers47
viewsA: Value of div being sent dynamically to php page
You do not need a form to send this value to the back end, for this you can use Ajax to know about it can see more in the documentation here. 1 - If you already have the value you want to pass to…
-
0
votes4
answers124
viewsA: Insert Parentheses between an acronym in the input field
Just another way that can be done: var quadro = document.getElementById("quadro"); function maiusculo() { var valor = quadro.value; quadrocorrige = "(" + valor + ")";…
-
1
votes2
answers79
viewsA: Going through an archive of constants
If you want a simple way to do this is instead of using multiple constants, leave everything in one within one array and make a for to go through the data: const USER = ['user_info', 'user-search',…
-
1
votes1
answer41
viewsA: Slimselect + Angular 6
I do not know if it could solve, but it lacked to put the definitor of the element, in the case there a id #. import { Component, OnInit } from '@angular/core'; import SlimSelect from 'slim-select';…
-
1
votes3
answers64
viewsA: Problem with animation in the Menu
An example only to leave registered using Javascript: var lis = document.getElementsByClassName("li"); for (var i = 0; i < lis.length; i++) { lis[i].style.display = 'none'; }…
-
0
votes1
answer978
viewsA: Search for data in JSON file
Good if what you want is to take this array of objects and convert it into a file .json valid, you will have to make the following changes, because Json data has different formatting than a data in…
-
0
votes1
answer340
viewsA: Ordering of Dropdown Angular4
I confess that I did not understand your question, being the data you want to order in fixed alphabetic order, I did not understand the pq does not order them in variable states even, however,…
-
1
votes1
answer433
viewsA: 1 item on the left and two items on the right good bootstrap
You can easily achieve the desired result using the classes float bootstrap: img { width: 100px; height: 30px; } a { padding-right: 5px; } <link rel="stylesheet"…
-
1
votes1
answer312
viewsA: Do I need to compile Vue in order to see the style changes I’ve made?
1 - No, no need to build, build is for when your application is ready and you want the files to send to production, can read more about here. For you to run the project and view your changes give…
-
1
votes1
answer1283
viewsA: How to put mascara in the form input field that is in a modal bootstrap window
Strange guy, here in the example is running the mask inside the modal normally, see if the file Mask is referenced on the page where the modal is opened: $(function() { $('#tel').mask('(00) 0…
-
4
votes2
answers3823
viewsA: Responsive menu using Bootstrap
As you can see in the example below, the Hamburger menu is there, it turns out that your Css was overwriting that of Bootstrap. There are some classes that can help you style without having to touch…
-
0
votes4
answers183
viewsA: Compare if password is correct
You can do this exercise like this if you want to too: If password is entered 3 times wrong the message blocked account is displayed, otherwise the message Free access will be shown. var btn =…
-
2
votes2
answers44
viewsA: Selector lt() does not work
As you can see in the example, the method :it’s() works perfectly for the purpose it wants to apply: $(function() { $(".dado:lt(5)").on("click", function() { $("#download").prop("href",…
-
1
votes1
answer33
viewsA: Problems calling a Javascript function in an html buttom!
As you can see in my example, your code is working normally, I just made some changes in points that were not correct: 1 - You have to declare the variable cont also out of function nome(), because…
-
10
votes2
answers4144
viewsQ: Difference between _Blank/_self and Blank/self
I wonder if there is any recommendation in the use of Html attributes target with or without the _ before the value, I see that it’s kind of standard to use it with _, but if it is absent the…
-
1
votes1
answer37
viewsA: Change information with JS-JQUERY
If I understand correctly, you’re trying to manipulate the attribute date button. Then in the case as you have already used the method data you don’t have to write inside it data-content, but yes…