Posts by LeAndrade • 8,475 points
404 posts
-
0
votes1
answer33
viewsA: Button that when clicked displays an image, if clicked again displays another image
Your problem there is that as you do not assign any value to the attribute image will always fall into the else because the variable is undefined, one of the ways to do what you want is to insert…
-
0
votes1
answer56
viewsA: I am having difficulty transmitting message to the user
You need to have a array within the function adcCamp to be able to store the items added in the function, the way it did every time it added a participant the global array will be overwritten, such…
-
0
votes2
answers48
viewsA: After finishing the program, the "textContent" disappears quickly. My intention was to stay on the screen
As for the main problem (there are several), the information is not getting on the screen because you are using a tag <a>, as can be seen in documentation a hyperlink is created, a link to…
javascriptanswered LeAndrade 8,475 -
2
votes1
answer54
viewsA: How to add an HTML element with line breaks by Javascript?
Can use 2 crase signals (template strings), which as described the documentation: Template Strings are strings that allow embedded expressions. You can use multi-line string and string interpolation…
-
1
votes1
answer24
viewsA: Buttons to pass the slide does not work - Javascript
Your problem there is that you’re using the method addEventListener() wrongly, as their function plusDivs(n) receives a parameter you are inserting () within addeventlistener to pass this parameter,…
-
0
votes3
answers105
viewsA: How to create listeners for multiple elements in a loop?
I leave one more alternative to how it can be done, depending on your HTML, that was not posted. Vc can be based on a parent element and by the method find() find the child element desfocado:…
-
0
votes2
answers41
viewsA: Display json in different locations of my html statico
Even though I already have an accepted answer, I will leave an example with another approach, without the need to convert the array, which I find totally unnecessary, in addition to some other…
-
0
votes1
answer38
viewsA: How to close the navbar beyond the hamburger icon by clicking outside the menu field?
Although the implementation of classe has turned good, I did not understand why use the same, and could be done only with functions, however, as for what you want to do, a simple way is to take the…
-
0
votes1
answer27
viewsA: navbar-Brand + Toggler
One of the ways to get the expected result without using proper css, only bootstrap classes, would be to insert two elements span. In the first you put a class m-auto so that the rest of the content…
-
1
votes2
answers40
viewsA: How to list an Array in a checkbox, breaking by one of the Array items?
I don’t know what your knowledge in Angular, but, the assembly of directives *ngIf are wrong, also did not understand the pq to use tags li, but I will leave an example of how it can be done, for…
-
4
votes2
answers61
viewsA: Request for the Nodejs API
Starting from the point you are using Express, your problem there is that req.params as you can see in the documentation, returns an object containing properties mapped to the "parameters" of the…
-
0
votes1
answer66
viewsA: How to cancel tag a action?
If what you want is for the page not to follow the normal flow (load the page with the mentioned url), a way to do this would simply change the content of the link if I understood the question…
-
-1
votes2
answers57
viewsA: Is it possible to use jQuery effects with the <option> tag of a <select>?
You can’t turn on the event click directly to option, but, it manages to take the option that was selected with the method find() and using the selector :Selected check if this is what you want,…
-
2
votes1
answer39
viewsA: Modify a function while maintaining its functionality
I can keep this code working properly without having to use this excerpt? what is its need and meaning? Not if you want to make the search filter, the if(campoLinha) {} is responsible for checking…
-
0
votes1
answer151
viewsA: How do I search for Angular 8 id?
It is very simple this, indeed it has several ways of doing, one of them is passing a variable template in the input and pass the value that is entered in the function parameter fetch(): <input…
-
1
votes3
answers71
viewsA: How to take larger amount of each product and show within a list from the largest to the smallest?
Achieves the expected result using loops for. In the example below, I use 2 instructions for chained, in the first go I go through the array of objects that contains the data picking the value of…
-
1
votes2
answers47
viewsA: Get audio id played
It’s just that you have to understand what’s the difference between this, Event.target and Event.currentTarget in the scope of an event?, if you give a console.log($(this)) you will see that it is…
-
0
votes1
answer66
viewsA: How to make an Insert in the database from a many to many relationship in typeorm
What is missing there is that in the entity Idiom, a declaration of relationships is necessary, as can be seen in documentation: You can omit @Joincolumn in a @Manytoone / @Onetomany relation.…
-
0
votes1
answer47
viewsA: How to check if a text box has been filled via querySelector in one condition?
What happens there is that you have none else in your code, and you FOUND that if I didn’t fall in if (who is also wrong) would execute the other code as an Else, BUT NOT, whenever executing the…
-
1
votes1
answer48
viewsA: Cloning modified element with jQuery
By the code you posted, as can be seen in the example below, cloning works. What was missing there is that after you make the clone you should take its content with the method html(). Notice that I…
-
5
votes1
answer174
viewsA: Show DIV content by clicking on the image with slideToggle
The way the HTML, it is not possible to do it the way you tried, because the method next() needs to be with the nested elements for their proper functioning. There are many ways to do what you want,…
-
1
votes1
answer37
viewsA: Scanning JSON ...and repeating images
It can solve this in a very simple way, using seletores avançados of jQuery like the eq(). It finds an element in the DOM referencing itself by the element index: let catalogo = [{ 'nome': 'Polo…
-
2
votes1
answer37
viewsA: Bugle margins in CSS
If I understand the question correctly, what was missing there was you declare a maximum size for the conteiner, that is, the place that the other elements will fit, which in this case is the tag…
-
1
votes1
answer35
viewsA: Easyautocomplete does not find the searched value in the field
Well, according to documentation missed you pass the property list that has another property called match and mark the property enable as being true: var options = { data:…
-
0
votes2
answers559
viewsA: Angular 7 Cannot find a differ supporting Object '[Object Object]' of type 'Object'. Ngfor only Supports Binding to Iterables such as Arrays
First you’re missing the variable, you’re doing the ngFor for a service type variable (serviceFilms), would have to create a variable in the component to store the return of the service and work on…
-
1
votes2
answers41
viewsA: Object map does not return all data
One way you get the result you want and I think the best way, by being simpler, is to create the variable videosObject as being a array and simply make a push with the objects from the videos: let…
-
1
votes3
answers50
viewsA: How to declare a function that has calls with quantities of different parameters?
In the function declaration instead of setting the number of parameters in a form static what you can do is use Rest Parameters, so you leave the amount of dynamic parameters, no matter the amount…
-
1
votes3
answers79
viewsA: Skip css line keyframes
Just complementing the answers already existing here, I advise to use regex, pq this way can better manipulate the text, for example, if you need to have more than one tag <br> within the same…
-
0
votes1
answer66
viewsA: How to put an input value to be analyzed in a Promise?
The way you did, you’re already running the setTimeout() so after 2 seconds is already shown the value which also makes the code always fall into the catch() that would be the Reject(), because the…
-
0
votes2
answers217
viewsA: How do I place an eye icon that can reveal or hide password inside the input?
I’m going to leave a very simple example just by complementing the answer from @hugocsl, using icons from font-awesome implementing an icon exchange as you click: var tipo =…
-
2
votes1
answer161
viewsA: Add javascript plugins at angular 7
Good only to leave registered as response here on the site for future research on the subject. For the use of libraries Javascript in projects Angular in addition to the use of CDN links in the…
-
0
votes2
answers67
viewsA: Unlock button when hidden section appears
You can do this in a very simple way by chaining functions, to each click in the previous element the next element has its click event released: $(() => { $('a:eq(0)').on('click', () => {…
-
2
votes1
answer80
viewsA: Conditional Display in Javascript
You are mixing jQuery with Javascript(Vanilla) no need, this is very simple to do, follow an example I made with if/Else, but, in fact it would be possible to leave in a line only using ternary…
-
1
votes1
answer117
viewsA: Javascript - Variable gets Undefined after a function
So, what you’re trying to do won’t work anyway and probably on the console should be showing errors because: first : You are making a dependency injection of a common class. 2nd : You are using this…
-
2
votes2
answers287
viewsA: How to insert a div into a specific div using Javascript
You have to catch the div then add to it the one you created with a appendchild(), as well, as you can use strings template to avoid having to use concatenation +: let html = `<div…
-
0
votes1
answer102
viewsA: BOOTSTRAP card does not move
You have problems with your HTML. You are leaving spaces between class characters <section class=" BOX - 2"> so the style will only be affected in elements that have the class BOX BOX and not…
bootstrap-4answered LeAndrade 8,475 -
1
votes3
answers81
viewsA: How to view a modal automatically when entering the site?
You can open the modal using the event Domcontentloaded to perform a certain action when the HTML is loaded, for example by simulating the click in the link: let open =…
-
2
votes1
answer312
viewsA: Error sending a POST request via ajax
Well I think you don’t quite understand the concept of these methods for JSON, to send data to the back-end using the JSON.stringify() Json needs to be in a valid format, note that in your code what…
-
1
votes2
answers4059
viewsA: How do I take the value of an input and put it into a variable?
There are many ways to get the value of a input so much with Javascript as pure as with Angular using Typescript, how is using the second most desirable option is to use the techniques provided by…
-
1
votes1
answer47
viewsA: Add an object to a arrey
You have not quite understood the tools you are using, when you do the foreach() and the if() you already have the objects you need from the Api, you don’t need to create the object by passing the…
-
1
votes3
answers96
viewsA: Switch 3 status done in css, how can I disable the options?
One way to do what you want is by using the CSS property Pointer-Events, with it basically you can manipulate mouse actions in HTML elements, more explanations inserted in the code: let labels =…
-
1
votes1
answer120
viewsA: Reuse Angular component 8 by changing the json structure
I find it very strange that the return of the Api has different data structure, I think that this should not be so, but in your case it is possible to do what you want with a simple if/Else checking…
-
1
votes2
answers171
viewsA: Write JSON to Javascript object
You can use the method map() to map each object and its properties, then just store the values in a array: let retorno = {"status":"sucesso","dados":[{"id":"1","nome":"Nome do…
-
2
votes2
answers26
viewsA: Nan error in object array
You can also use the method reduce() to do what you want, it is very indicated when we need to manipulate values in arrays: var armazenamento = []; var PagoCliente = 50; var troco;…
javascriptanswered LeAndrade 8,475 -
1
votes2
answers62
viewsA: Disable disabled from an access-level button
You are using Angular so it doesn’t need any function to do either, in the TS just check which user type on ngOnInit() and store the value in a component class property and in the Html on the button…
-
0
votes1
answer253
viewsA: Dynamic form filling within modal div
You can do as in the example below, that I used the methods Jquery show() and Hide() to show/hide the elements as you click on the ok: $(() => { var verifica = false; // variável que faz o…
-
0
votes1
answer37
viewsA: Creating getFullYear with javascript
I think you got a little lost in the code when you inserted a for at the event change of select of manufacturing year making it difficult to control the years, in the example I did below I didn’t…
-
3
votes1
answer41
viewsA: What’s the problem? Just return Undefined when I try to specifically access temp
You are trying to access a property within an object so the syntax you used is not correct, the correct one using the square brackets would be ["main"]["temp"], that is, in each pair of brackets a…
-
1
votes1
answer58
viewsQ: How does the Symbol() data type work?
The type of data Symbol() has been implemented in the language since version 6 or 2015, but I did not understand its actual use. Looking at some practical examples found on the web, I saw examples…
-
0
votes1
answer160
viewsA: How to call an animation using the onclick - HTML + JS command
Because you are learning the language your code has several errors, it should not contain two or more of the same event Javascript in an element Html as it did in the onclick and also the way you…