Posts by Sam • 79,597 points
3,121 posts
-
0
votes1
answer32
viewsA: personalize the service to be provided (e.g.: inform the amount of private-classroom hours you want to hire)
Many problems in the code. Do not use () in id’s. Do not repeat an element with the same id - an id must be single page. Just call the function formqtd() on radios and the function aulaP() in the…
-
0
votes1
answer23
viewsA: Tag overlay in css
The selector by id # has priority over selector by class .. In your case, the selector .box p term priority 0011 and the #container p has priority 0101, soon 101 is greater than 11. There’s a topic…
-
1
votes2
answers59
viewsA: Run task only when CTRL and mouse are pressed
Can do using two events: keydown and keyup. The first will check if the pressed key is the CTRL (Cód. 17) and cancels the events that block the input, and the second (which means the key has been…
javascriptanswered Sam 79,597 -
3
votes2
answers156
viewsA: Check if automatically filled field is "True" jQuery
Then you’d have to change the attribute value, which is an input property: $("#campoRecebeDados").attr("value", campo); The .val() does not change this property, it just takes or changes what is…
-
1
votes1
answer20
viewsA: Error with prechimento and Submit of fields via ajax
The problem is that you are placing events within events. For example, you are placing $('#total-item').blur(function(){ within the $('#produto_desc').change(function(){. This causes a new instance…
-
0
votes1
answer36
viewsA: Problems while removing Row using JS in Asp.net Core MVC
The $(this) within the Swal function loses the reference. It is necessary to store it in a variable in order to use within that function. Before Swal, put: var $this = $(this); Now the variable…
-
0
votes1
answer75
viewsA: HTML checkbox for Javascript
You don’t need id's, as Sergio said. You can select the elements by name's, but it is interesting to include each group of elements within Divs, as it will facilitate the selection of elements to…
-
2
votes2
answers91
viewsA: JS not formatting the thousand value correctly for Input and not receiving correctly in PHP / Database
There are some inaccuracies in JS code and PHP. In JS you are using in toLocaleString the format en-US when it should be pt-BR to exit in format R$ 1.000,00: return v.toLocaleString('pt-BR', {…
-
2
votes1
answer945
viewsA: How to run a link after Sweetalert confirmation?
The if (result.value) { will be satisfied if Sweetalert is confirmed. Then just take the value of the href and redirect with location.href: function enviaDivida(e){ e.preventDefault(); const…
-
0
votes2
answers167
viewsA: Check if canvas is drawn
One way is to check through the events mousedown and mousemove (touchstart and touchmove for touch devices). Imagine this: when the user clicks on the canvas area, it will trigger the event…
-
0
votes1
answer42
views -
2
votes1
answer54
viewsA: I need an equal contact has on these promotion sites, type promotion ends in x days!
It is possible to do this as follows: First the variable countDownDate must be only the object new Date without the property .getTime(), so that it can be amended at a later date: var countDownDate…
javascriptanswered Sam 79,597 -
2
votes2
answers66
viewsA: Event with onclick
It’s easier to create a class and use .toggleClass() at the click of the button. For example, you create a class and place the properties of the style: #busca.aberto{ width: 200px; transition: all…
-
0
votes2
answers72
viewsA: Filter two values in a text type variable
You can do this in a very simple way, using a regular expression to pick up the two numbers from the last bar /, the first number being the value of "idManga" and the second the value of…
-
1
votes1
answer119
viewsA: How to call an on change function already declared
Here was missing to put .hide(): $("#precoAbsoluto2").???? And also missed to close the second if with }. Another thing is that the quotes to delimit the PHP variable in:…
javascriptanswered Sam 79,597 -
2
votes2
answers2172
viewsA: Javascript removing zero numbers at the beginning of a string
The problem is that you are passing the direct number as the .val(). So the zeros on the left will be ignored. Supposing @item.Inscricao.cpf_candidato be it 00885355849, then jQuery in onclick where…
javascriptanswered Sam 79,597 -
2
votes2
answers603
viewsA: How to update a row in the table with ajax?
From what I understand, you just want to change the class of the button clicked after the return of AJAX, so you don’t need to receive any feedback response. The only thing you need to send in AJAX…
-
1
votes1
answer143
views -
1
votes1
answer300
viewsA: Line below the text
Missed putting position: relative us H3 so that the pseudo-elements, which are the lines, position themselves absolutely within the H3. With this, just use bottom and left, to the left lines, and…
-
2
votes2
answers373
viewsA: How to change body color with onclick() from Buttons? Javascript
The problem is that you are using these kind of quotes ” (known as quotation marks or curved quotes) in the attribute id which does not work as delimiter: or uses normal double quotes " or simple '.…
-
1
votes2
answers164
viewsA: use fetch api to present user cards, innerHTML overwrite cards
The .innerHTML replaces all the content of the element with another HTML code. As you are using it within a .forEach, will only remain in the element the last HTML resulting from the last loop of…
-
1
votes3
answers51
viewsA: Add values of fields in jQuery
Create a function that sums the fields. Within the function you use a .each() to go through each field with the class .money and add up the values, but you need to remove the commas from the values…
-
0
votes2
answers131
viewsA: How to include a Refresh in window.open with _Parent?
Add a timestamp in the image path that will avoid browser caching: echo "<img src='xxxx/foto.jpg?". date("ymdHis") ."'>"; The function date("ymdHis") will always add a unique value every…
-
0
votes2
answers64
viewsA: I can’t get the value of the column next to my input
Jefferson, an id cannot be repeated. Change the id #custo by a class="custo". And the .closest() will not fetch a "side" element, it looks for a closer parent element. And do not use .innerHTML with…
-
0
votes3
answers101
viewsA: Function if you change css
You can do this way, where you will "filter" and change the width of Ivs according to attribute value data-filter link clicked (see comments in the code): // seleciona todos os links da ul const…
-
1
votes1
answer106
viewsA: With setting the deadline on the dynamic datepicker?
Just take the current month and the current year and use a Setter to change the options minDate and maxDate of the component. The minDate is simple, just put the value "0" that the initial date will…
-
1
votes2
answers467
viewsA: How to put a json returned from an API within a select?
It is necessary to pick up the objects inside installments return with the same name. It would be: let inst = installments.installments; The first installments is what comes from the return of the…
-
2
votes1
answer273
viewsA: Bootstrap menu button color does not appear
Use the class .navbar-light on the button to make the burger color dark: .navbar{ padding: 0.5rem 0; } .bg{ background-color: #F4F4F4; } .nav-link{ color: black; font-weight: 500; } .btn{…
-
0
votes1
answer43
viewsA: Slide with active initial image
In addition to starting the image with the path of the array’s first position images, it is also necessary to claim the value of i and instead of using the fixed value 3 in images[(++i)%3], replace…
-
1
votes2
answers224
viewsA: Take part of the CSS class name
Yes, just you use: [class^="result_itens_"]{ propriedades aqui } The selector ^= will take all elements that have the class started with result_itens_. The sign ^ means beginning. It will work in…
-
1
votes1
answer131
viewsA: file.width and file.height - Does not work in Dropzone.js
The properties file.width and file.height do not exist in the Dropzone. Just do a console.log(file) and you’ll see that they don’t exist, only file.name and others (such as the weight in bytes), but…
-
0
votes3
answers2203
viewsA: Change value of an Hidden input with jquery
Put a hash on href of links, add a class (put class="tipo") in each and a dataset data-tipo = "1" value link 1 and data-tipo = "2" link value 2 and use an event click in class .tipo canceling the…
-
1
votes1
answer33
viewsA: Catch the children directly from ul
You don’t have to use > on the dial in .children(). If you want to find direct children li of ul cloned, just use the selector li: clone.children("li").each(function() { The method .children()…
-
0
votes2
answers41
viewsA: How to make an AJAX call through the post
In no time are you calling the function FiltrarRelatorio and is just submitting the form to the page itself, causing it to reload. What you have to do is cancel the form Submit and call the function…
-
0
votes5
answers431
viewsA: Go to certain link depending on the page
The location.href returns the whole URL and not just the current page. Instead of redirecting to a page based on the URL or page name, in my view it would be more practical to insert a variable on…
-
0
votes2
answers62
viewsA: How to play this value for an input field?
Note that the input you want to fill in is of the type number, so you’ll only accept numbers. If the id you want to pick up and play on the field is not a number, the field will be empty and a…
-
2
votes1
answer2388
viewsA: I can’t center the video
The margin: 0 auto; will only work with block elements. Then just add display: block; on the tag video: #corpo video{ width: 750px; margin:0 auto; display: block; } <div id="corpo">…
-
1
votes1
answer56
viewsA: MATCH THIRD ELEMENT REGEX
You can do it by breaking the string texto in array by tags </p> and then reassembling the texto with For Each adding the tags again </p> and when you arrive at the third loop lap, add…
-
1
votes2
answers158
viewsA: Take element from a string
Another way is by using .split() picking up the index [1]: var string = "Hello [background]image.png[background] World!"; var novo = string.split("[background]")[1]; console.log(novo);…
-
0
votes1
answer82
viewsA: Classic ASP Carousel (Concatenation)
It’s wrong even that: <% & i & %>. The right thing would be: <%=i%>, that will pull the value of i of for and insert into HTML. And it’s not really a concatenation, you just want…
-
1
votes1
answer73
viewsA: System of multiple choices in Javascript
You don’t need to use as many id’s for this. Only with class is possible and much simpler. Note that there is still a syntax error in your code: The "get" in document.GetElementById is tiny ->…
javascriptanswered Sam 79,597 -
1
votes1
answer61
viewsA: Adding variables in javascript
Just go through each quantity input with .each() and add the values. Note that the variable badgeCount beginning of 0: $(document).ready(function(){ $('.buttonAdd').click (function(){ var iqtd =…
javascriptanswered Sam 79,597 -
2
votes1
answer67
viewsA: How to capture the unique element in HTML?
How to capture the unique element in HTML? An id should be unique on a page. This error is very common around here because people do not know its use well. The attribute name itself indicates that…
-
1
votes2
answers82
viewsA: Error when referencing an object’s value in another javascript object
You are referencing the object dados inside itself. It will result in error because the variable dados not yet initialized. When trying to build the object, Javascript will try to fetch the value of…
-
-1
votes1
answer47
views -
1
votes1
answer143
viewsA: How to generate a dynamic ID for my Button with PHP and move to JS?
You don’t need to use id to get the click. Just pick a class from the button. Add another class to the button, something like deletar, thus leaving the classes: class="bg-transparent border-0…
-
0
votes2
answers645
viewsA: How to center Brand logo on Bootstrap 4 and leave menu items below?
You can create a media query rule when the screen has 768px up, applying flex-direction: column; in the div .container. This way, the logo and menu will be aligned in column form, one below the…
-
0
votes1
answer24
viewsA: Leave inline images in a div overflow
You could use flexbox in div .ove, because then the images were aligned next to each other. Just put display: flex in the div .ove: .ove{ width: 100%; overflow: auto; display: flex; /* flexbox */ }…
-
1
votes2
answers199
viewsA: Javascript does not work in IE 11
IE11 does not actually support Arrows functions and the .forEach. In the updated version I tested here, the classList worked perfectly. What you have to do is change the arrows functions for…
-
1
votes2
answers153
viewsA: Determine CSS property based on a javascript condition
It’s basically like the friend said in the other answer, but you can make it into shape using querySelector(".tipoMov"). When going through each row of the table, querySelector will fetch the…