Posts by Felipe Coelho • 569 points
33 posts
-
2
votes1
answer199
viewsA: how to add an if inside a . append() in Jquery
See if that helps you. I created a list of items using the data-value property as well. It checks the value of this prop and displays an Alert if it finds the value: HTML: <ul…
-
0
votes3
answers185
viewsA: Where to place a function "toFixed()` to round up the value?
How the prompt returns the entered value you can do: var p = prompt('Entre com um grau em Fahreinheit: ') console.log(parseFloat(p).toFixed(2))
-
0
votes1
answer78
viewsQ: Get data stops with Node.JS
I’m trying to get information sent via POST in Node.JS, thus: I call the API that: $.ajax({ method: 'POST', url: '/api/post', data: { xml: '<?xml version="1.0"?><query><author>John…
-
0
votes1
answer430
viewsQ: ng-model of an object
I have a controller: function ItemsCrtl($scope) { $scope.items = [ {id: 0, name: "PC"}, {id: 2, name: "GEladeira"}, {id: 3, name: "Fogao"}, {id: 4, name: "cama"}, {id: 5, name: "privada"}, {id: 6,…
-
1
votes2
answers1766
viewsQ: Position Absolute within a Hidden overflow
HTML: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>JS Bin</title> </head>…
-
0
votes1
answer92
viewsQ: Use imported js file in html in an ES6 application
I am developing an application with ES6 and doing the build with Webpack. This application will be in a template that already imports jQuery via <script src...></script>. How would I…
-
1
votes1
answer477
viewsQ: Search and view objects items nested with Javascript
I have two lists, Aggregation brings me the codes of the categories and the list Categories brings all the categories I have registered. I need to search categories in categories using Aggregation…
-
2
votes1
answer282
viewsQ: Event with and without addeventlistener are not equal?
Because this doesn’t work: window.addEventListener('beforeunload', function(){ return 'wait a minute' }) And this works: window.onbeforeunload = function(){ return 'wait a minute' } They’re not the…
-
1
votes4
answers7774
viewsQ: Calling javascript function only once
Suppose I have a button that when clicked calls a javascript function. I would like that if this button were clicked several times it would only call this function once. There are ways to do this?…
-
1
votes2
answers398
viewsQ: Difficulty to remove item from inverted list in Vue
I’m picking up at the time of using list in Vue. I display on the screen a list reversed by a computed. I need to display it upside down so when I add an item it shows up on top. Only the way I did…
-
0
votes1
answer313
viewsA: Inserting Vue Component into the DOM via jQuery
Solved!! I created an array that would be like the v-model of this list that I keep adding on the screen. So I surrounded my html code with v-for iterating this list: v-for="item in itemList"…
-
3
votes1
answer313
viewsQ: Inserting Vue Component into the DOM via jQuery
I’m using Vue in an application where I have a list of items and a button to add more items. By clicking add I load an external html with a component: <div class="gutters-8 col-lg-6"> <div…
-
2
votes0
answers164
viewsQ: v-model in the Component
I’m trying to use the v-model inside a component but it doesn’t work. Code main.js, which will have the information used in the v-model: import Vue from 'vue' new Vue({ el: '#app', data: {fields:…
-
1
votes2
answers40
viewsA: Javascript - Function that changes the background of the parent element
With Document.getElementById("category") you are looking for an element with id category but it does not exist in your html, you need to search for an element with the category class. For this you…
-
3
votes1
answer194
viewsQ: Specific doubt using ng-repeat at angular
I am using Angularjs in a project where I need to display a list of photos of products registered in the system and my html is like this: // Titulo para a área de produtos <div…
-
1
votes0
answers17
viewsQ: Using history in angular js
Is there any way to use browser history in an angular SPA application? I am developing a client search application and I was asked that the user has the possibility to, for example, when a 5…
angularjsasked Felipe Coelho 569 -
2
votes1
answer922
viewsA: Angular script loading failure (ng-view)
To those who go through this problem, follow the solution. In the script tag, which imports the mdl javascript enter the attribute Defer. I also used a Directive to upgrade the html tags that…
-
0
votes1
answer83
viewsQ: Add event to a Directive element
I have a Directive that within it has a list. This list is populated after the successful response of an ajax call. For this reason my Directive link function does not find this list as soon as the…
-
0
votes1
answer922
viewsQ: Angular script loading failure (ng-view)
I’m doing an angular js design and using the lite design material (mdl) for the layout. Some MDL files need a javascript file to work but this file has to load, sometimes not. I believe that the…
-
5
votes1
answer284
viewsQ: Doubt with Javascript Arrow Function
In the code below, the method showName() naturally return undefined, because it will fetch a name property in the scope where the obj is inserted. My question is, in that case I would necessarily…
-
0
votes1
answer85
viewsA: Problem with html5Mode angular
I was able to solve the html5Mode problem. Mine was pointing to a wrong folder address for my project. Now it’s ok!
-
0
votes1
answer85
viewsQ: Problem with html5Mode angular
I set up my app Angular using #! in the links url, I am now trying to use the html5Mode but it’s not working. The folder structure of my application looks like this: At the root is the index.html, a…
-
0
votes1
answer78
viewsA: Make the width of the <ul> equal to the width of an image inside a <li> of the <ul>
Put float: left on your ul, so the size of ul will suit your content. HTML: <ul> <li><p>Texto texto texto</p></li> <li><img…
-
1
votes0
answers46
viewsQ: Table Printing Problem
I have a product chart and I’m putting together her layout for printing. I am using the tag so that the column title is repeated to each new page in the print but the customer did not like the…
-
1
votes2
answers665
viewsQ: When using jQuery append displays the text [Object Object] and does not insert the element
I created a div.box in html and I want to insert another div that I create in the execution of the code, follow the avaixo: HTML: <div class="box"></div> JS: var item = $('<div…
-
2
votes2
answers307
viewsQ: Calling function outside the scope in javascript
Follow the code to explain my mistake: class Cliente { showName(name) { alert(name) } getName(){ $.get(minha-url) .done(function(data) { this.showName(data.name) }) } } The getName method returns an…
-
1
votes1
answer1466
viewsQ: Visual Studio Code closes file alone
In Visual Studio Code when I open a file and soon after I open another file I will work it automatically closes the first opened file. How do I stop it?
-
0
votes2
answers862
viewsA: Cancel <a> tag click event
Rersolvi by inserting a data attribute to the link that is true proceeds with get or else makes a false Return.
-
2
votes2
answers862
viewsQ: Cancel <a> tag click event
I need to create a Javascript function that is called when clicking a button and must cancel the click of a tag <a>. I tried this way: $("#botao").click(function(){ $("a").unbind('click') })…
-
2
votes2
answers619
viewsQ: What is the correct way to use an npm-installed package?
To explain my question I will use jquery as an example. I installed jquery from npm (npm install jquery). Then npm created the jquery dist node_modules folder where the jquery file I need is…
-
7
votes3
answers1883
viewsQ: Bind Javascript
I wrote this code as a study for understanding bind. I create a method on an object and try to call it by changing Scope to another object. let car = { sound: 'Vrrrrummm', startEngine: function() {…
javascriptasked Felipe Coelho 569 -
1
votes1
answer114
viewsQ: Doubt using the Javascript Proxy API
I made this code to study Javascript Proxy. It works by detecting the change of the object’s property but when I call the property on the console.log it does not appear changed JS var f = {nome:…
-
0
votes1
answer496
viewsQ: Check if an input was loaded with jQuery
I need to check if a text input has been loaded on the page and check if it is filled in, how can I do that? I’ve tried $('input'). on('load') but it doesn’t work, and the way the script is done I…