Posts by Sam • 79,597 points
3,121 posts
-
0
votes1
answer49
viewsA: How to delete non-numeric characters, which were added by Mask?
Is resulting NaN why are you using Number() in fields where the mask is adding non-numeric characters, such as R$, space and %. You can create a function that removes what does not matter for the…
-
0
votes1
answer51
viewsA: error with bootstrap
What’s making the images smaller are the classes col-md-4 and col-sm-6, which, by the structure of the Ivs, seems to me unnecessary. Another class that is bugging the dark div at the Hover is the…
-
3
votes2
answers66
viewsA: Promise executed out of order, how to resolve?
The .then needs a callback function. Without the function, the console.log is executed immediately: function wait(time) { return ( new Promise(resolve => setTimeout(resolve, time)) ) }…
-
1
votes2
answers56
viewsA: Titles together with image using flexbox
Your code is very inconsistent, especially CSS. I don’t understand the use of several classes with names in sequence: post1, post2, post3 etc., when, in my view, I should use a single class for all,…
-
2
votes1
answer1218
viewsA: Clear Form after Submit and continue on the same page, only with PHP and Html
Do not need to redirect, because, you are referring to your previous question where I suggested using an iframe to save the data, and the page will be redirected within the hidden iframe, which will…
-
1
votes1
answer201
viewsA: View sessionStorage data in a div
The problem is that you are objects wrongly. For example, the variable var result = $("#resp"); is a jQuery object that does not use .innerHTML. To insert HTML into an element with jQuery object is…
-
0
votes2
answers117
viewsA: Consume json file locally with jquery or javascript
The problem is that the method $.get receives JSON in string form, and would need to parse the return data with JSON.parse(data), but jQuery has a method that already does this, the $.getJSON():…
-
1
votes2
answers76
viewsA: Change the text field by selecting a dropdown option
A simple solution is to add the Bootstrap class .d-none to the fields that will appear hidden initially, and add any class (I put .f) in the same fields so you can control them. In the menu links…
-
0
votes1
answer20
viewsA: How to remove parts of a field name in a serialized structure?
I don’t know where this is coming from PessoaViewModel., but you can remove it with a replace using a regular expression. Just add .replace(/PessoaViewModel\./g, '') in serialize: var…
-
2
votes1
answer47
viewsA: How to remove div from the page to appear only in Popover
As commented by @Benilson, you can hide div com display: none: $('#texto').popover({ html: true, content: function () { return $('#teste').html(); } }); #teste{ display: none; } <script…
-
3
votes1
answer77
viewsA: Progress Bar with hours
Since you have not put the code of the time text, the solution just to hit the bar is using box-sizing: border-box; on Divs, so the edge will stay inside the element and not make it more 2px wide…
-
3
votes3
answers998
viewsA: Displaying successful Alert() on the same page. PHP, Html
A simple solution is to send the data to an iframe on the same page. Just put it on the page: <iframe name="gravar" style="display: none;"></iframe> And in the form put a target pointing…
-
1
votes3
answers126
viewsA: How to extract values from a column and separate them with a comma
In your case it would be better to create an array and then convert to string with .join(", "). Use document.querySelectorALL with the selector "#ID DA TABELA tr td:first-child" to take all cells…
javascriptanswered Sam 79,597 -
3
votes1
answer47
viewsA: How to calculate a column with a comma as decimal
It’s because you need to replace the commas by a dot and change parseInt for parseFloat. Decimals in Javascript are separated by point. Just make a simple replace: sumVal = sumVal +…
javascriptanswered Sam 79,597 -
0
votes3
answers74
viewsA: How to activate only the next div?
Another way is by taking the class index .flip clicked and apply to the same class index .panel. The advantage of this way over the .next() is that the element .panel does not need to be brother to…
-
6
votes2
answers118
viewsA: What’s the difference between executing code inside or outside the "for" keys?
The for is composed of 4 blocks, as explained by MDN documentation: (inicialização; condição; expressão final){ declaração } The block expressão final is executed after each loop iteration. With…
-
1
votes1
answer79
viewsA: compare Sql data with two Foreach
The way you are doing will go wrong, because the second foreach will generate several attributes style on the button due to the fact that when the if is not satisfied, will enter the else and create…
-
2
votes1
answer506
viewsA: Block Datepicker Date Range Javascript
You don’t need the option "minDate" and "maxDate". Use the option beforeShowDay as below: beforeShowDay: function(date){ var hoje = new Date(); // pega a data atual if ( date.getDate() > 20 ||…
-
3
votes1
answer48
viewsA: Adapt button display more Ivs to hide the displayed Ivs
Just one remark: Your script does not show 4 in 4, but 2 in 2, because of the .slice(0, 2). What you can do is create another "Press Less" button similar to the "Press More" button and put an id on…
-
0
votes3
answers94
viewsA: HTML validating with javascript
A more simplified way is by using .querySelectorAll(), picking only the radios checked from each group, and then comparing with an array with the answers: var gabarito = ["a", "c", "d"]; function…
-
1
votes1
answer1461
viewsA: How to make a each in Datatable and get only the selected lines?
Selected lines win class .selected. Then you just go through all the rows of the table and take only the ones that have this class and add the value in the array vObj[]: $(document).ready(function()…
-
0
votes1
answer48
viewsA: Get total record found during a search
According to the plugin documentation, you can use the callback onAfter to count how many lines are visible in the table when typing something in the search field. To count the visible lines, use…
javascriptanswered Sam 79,597 -
1
votes1
answer660
viewsA: Open modal after form Ubmit
As the parameter ?login is added to the URL when the user is redirected when he misses the login information, you can open the modal manually by identifying if the URL contains ?login with: <?php…
-
0
votes3
answers986
views -
0
votes1
answer376
viewsA: How to fix button at the bottom of a page without moving?
Use position: absolute with bottom: 15px in the svg it will be fixed at the bottom of the screen, without being influenced by the paragraph or other element, because it will be positioned absolutely…
-
0
votes1
answer34
viewsA: Non-Submit form after dynamically deleting a div with javascript
The error is because you are hiding an element with the attribute required, and with that he stays unfocusable (no ability to receive focus). When trying to submit the form, the browser will try to…
-
4
votes1
answer38
viewsA: Terminal printando in yellow
The colors are to differentiate strings from other types (such as boolean and numbers). In the CMD of your print the strings appear blank. In browsers there is also color differentiation. In the…
-
1
votes1
answer181
viewsA: Print every HTML page
You can use the property -webkit-print-color-adjust: exact;, but, as the documentation informs, it is not a standardized property and may not work on all browsers or devices. Testing on Chrome, it…
-
2
votes2
answers67
viewsA: Spacing in table
You can do something like this: .home-imovel-time-info { margin-top: 30px; } .home-imovel-time-info td, .home-imovel-time-info tr { color: black; } .home-imovel-time-info td { padding: 10px; border:…
-
1
votes1
answer262
viewsA: Message from Alert Bootstrap in page header
Just put the <p> of the messages in the place where you want. You are placing after the form, then it will appear below itself. For example, you could put after span where you have the word…
-
1
votes1
answer220
viewsA: How to mark an X in part of an image when firing a function in Javascript?
There is a way to highlight the mapped part using clip-path CSS. Just create a span inside the same div where the image is and use the same values as the attribute coords in the values of clip-path,…
-
2
votes2
answers1028
viewsA: In white-space, what is the difference between pre, pre-line and pre-wrap options?
The difference between each of the values is basically how to treat spaces. In HTML, when there are 2 or more spaces in the source code, the browser renders as only 1 space, and breaks the line of…
-
2
votes1
answer79
viewsA: PHP - Create an associative database array
There is no way to create associative array with duplicate key values, they are unique. What you can do is create a multidimensional associative array where key values would be in that structure:…
-
4
votes2
answers1203
viewsA: How to create a mask for Brazilian currency with character limit?
Place at the beginning of function one if with the replace indicated by the friend @Null in the comments, adding the method .length that will return the number of digits in the input. Just need…
-
2
votes4
answers5284
viewsA: How to center the elements within a div?
Both the element div as to the element p are block elements, thus placing margin: auto in the father div .center will not align them to the center. You need to use a selector that will align…
-
3
votes2
answers544
viewsA: How to scan an array of objects and return their values in a string
With a simple for...of you read the array and its objects: var usuarios = [ { nome: "Diego", habilidades: ["Javascript", "ReactJS", "Redux"] }, { nome: "Gabriel", habilidades: ["VueJS", "Ruby on…
-
1
votes1
answer114
viewsA: Place decimals on Chart Gauge JS
Looking at the documentation, just put the option step with a decimal value (eg., .1) that will accept decimal numbers: /// ### ---- ### sample level workaround ### ---- ### /// var fn1 =…
javascriptanswered Sam 79,597 -
2
votes1
answer73
viewsA: How to adjust a div correctly?
Use flex: 1 in the blue div. This will cause it to occupy the remaining area of the container minus the other two Divs: .botao1 { width: 40px; background: red; height: 40px; } .botao2 { width: 40px;…
-
2
votes1
answer333
viewsA: How to validate 2 checkbox groups
You do not need to use as much code to check if a checkbox has been marked within a group. Only with... var funcao = document.querySelector("[name='funcao[]']:checked"); ...you can know if any…
-
2
votes2
answers87
viewsA: Change attribute of an element without identification
Based on your code, you can find the span in question and change the text using the selector: $("#panelFormula > .panel-heading span").text("novo texto"); Example: $("#panelFormula >…
-
1
votes1
answer106
viewsA: Fill option with Flask data - Front x Backend
You can use a simple AJAX with jQuery. Put a id in the select to have a reference: <select id="horas" class="form-control" style="width:120px"> <option selected…
-
1
votes1
answer122
viewsA: How to avoid distortion of pixels in HTML elements in various screen/screen settings?
Coincidentally, because you mentioned your colleague using 125% scale across Windows, I use a 125% zoom in Chrome here on Sopt. That’s because my monitor is fullHD and in normal zoom the site gets…
-
1
votes1
answer66
viewsA: returning array in php and insert into html
There is a basic error in your AJAX: the correct is dataType ('Capital T' and not datatype. This error makes the return not a parsed JSON, but only a JSON string. Another problem is that the return…
-
0
votes1
answer120
viewsA: How to handle the DOM of a XHTML file with javascript
You have to assign value to these "global variables" within the functions that use them, otherwise they will always be empty, because their values are being assigned at the opening of the page and…
-
3
votes1
answer32
viewsA: Take array address with ID and use in an IF
I don’t think you need an array. Just send the id as a parameter in the function and show the value of the respective object key orgaos: function teste(id){ let orgaos = { cerebro: 'parte do sistema…
javascriptanswered Sam 79,597 -
2
votes2
answers57
viewsA: Problem with :Nth-Child() using margin-right
The @hugocss response works in this case, but I’ll leave a reply that works better when I have other @media where I want to show less Ivs per line, like 3 or 2. Use only the n, which it will apply…
-
2
votes2
answers57
viewsQ: Problem with :Nth-Child() using margin-right
I have a div .container with several Ivs .box where I want to show 5 Ivs per line when the width of the screen is greater than 1439px. Every div .box has a margin top and right of 15px, only that I…
-
1
votes4
answers687
viewsA: Disable html element with jquery
The attribute href does not apply to the item th. He should be in the element a: <a href="#"... The properties readonly and disabled are for form elements (input, textarea, select etc.). You can…
-
2
votes2
answers84
viewsA: Keep in array the serialize
Like Victor said, use .serializeArray() but you need to create a JSON to pass the parameter filtros. Just use a .each() creating the JSON array items: function filtrar() { const filtros =…
-
1
votes1
answer63
viewsA: What’s wrong with my Javascript scroll tag body code?
Who scrolls the page is the object window, and not the body, unless you’ve put an overflow on the body with set height. Your correct code would be: $(window).on("scroll", function(){…