Posts by Sam • 79,597 points
3,121 posts
-
4
votes1
answer33
viewsA: jquery"Animate()" is not working
To documentation says: All Animated properties should be Animated to a single Numeric value... That is, the transform and the filter used do not have only a numerical value, so they won’t work with…
-
-1
votes1
answer55
viewsA: How to simplify the code and not repeat so many inputs?
You can create fields dynamically using strings template. Just take the selected amount from select and make a loop with the chosen amount and add the HTML to the parent div. We already have name…
-
0
votes1
answer22
viewsA: Appear days of the week and times only be selected on the datetimepicker
Leave array empty does not work. Use option timepicker with the value false which will hide the time column for the specific day of the week (or more than one day) you want. Taking advantage of the…
-
2
votes1
answer22
viewsA: Apply Border-bottom to link but not to image
It is possible. Just put a class in the tag a where you don’t want to edge and add that class into the :not(): .post-body a:not(.semborda) { padding-bottom: 1px; border-bottom: 1px solid #000; }…
-
2
votes1
answer30
viewsA: How to clear elements of a <table> line when clicking a button?
Learn to use event listeners (Event listeners) instead of attributes onclick. Then you use the class that exists on each button of the lines - in your case, if the class class-buttonClear is just…
-
-2
votes2
answers120
viewsA: How to organize a JSON by date
Updated If it is to arrange by customer code and dates in ascending order (both things), then you can use a .sort() with a return within a if comparing dates if the client code is equal in the two…
-
1
votes2
answers460
viewsA: Position of arrow in select
select is the user-agent it renders, and this varies in each browser. Even by placing padding, the select arrow continues in the same place. Padding will only act on the internal content of options.…
-
0
votes1
answer44
viewsA: Msg error in case of JS typing error
You can do this more dynamically, without having to create a change event for each element. With only one event change you can already handle all the elements, just put an equal class in each…
-
0
votes1
answer36
viewsA: Send formatted elements to modal
Makes a .append() with the numbers within a span, and that span you format in CSS. You also need to empty the div before otherwise it will accumulate with what you already have there. For this you…
-
1
votes1
answer135
viewsA: Query database and display in modal window
Missed to open the modal. As you want to open the modal manually with the click on the button, you use the command: $('#dataModal').modal('show'); It is also interesting to put a message in the…
-
1
votes1
answer286
viewsA: Datatable order by Data en
One way is to put an attribute data-order (see documentation) in each td of the column you want to sort. The value of this attribute must be in the format "YYYY/MM/DD HH:MM:SS". For example: <td…
-
2
votes1
answer89
viewsA: How to capture keys inside an iframe
The function teste() is in the main document where the iframe is, and how you placed the event calling the function in the body iframe, the event does not find the function, so it gives this error,…
-
2
votes1
answer36
viewsA: How should the dynamic filling of the gender of a particular piece of clothing be done?
You would have to include more information in the options of "Clothes" to know if the chosen option meets only woman, because the program has no way of knowing that "skirt", for example, is only for…
-
4
votes3
answers1204
viewsA: How to get the system date in Javascript?
The date is already in the time zone that the device is configured. If it is configured for Brasilia time, for example, it will be UTC (Coordinated Universal Time) -3 o'clock. To catch year, month,…
-
1
votes3
answers468
viewsA: Menu button with "toggle" event
You can do it without using toggle, classList or classname. Just create two CSS shots using an attribute data-ativo, one with display: none so that the menu already click hidden when it is equal to…
-
1
votes1
answer258
viewsA: How to clear the data of the fields that were requested by JSON when the client is not selected?
First do not use the click event, it is not suitable for a select. This is because every time you click on the element will trigger the event, even when you open it without choosing any option. This…
-
2
votes1
answer113
viewsA: To define the value of a css variable by java Script
You can use the method .setProperty(), which changes a property within a CSS style block: function update(){ var vida= document.getElementById("vida") var value= vida.value…
-
2
votes1
answer46
viewsA: How to center an H3 with background-color?
Exchange the margin-top: 10px for margin: 10px auto 1em auto;. Block elements, when smaller than the width of the viewport, have auto margin on the sides, they center horizontally. The margin with 4…
-
3
votes3
answers84
viewsA: How to display a person’s name within the title="" tag label that is in a <input> in a PHP form?
You can initially leave the input without the attribute title, and use the event change to concatenate the default title text + the name of the person selected in select:…
-
2
votes1
answer61
viewsA: Table color yes/ color no by jquery
Instead of applying the background color to each column, you can apply to the entire row that will already affect all columns in the row, and you can still avoid this if...else with repetitive…
-
0
votes3
answers383
viewsA: Change Bootstrap 4 button background
Create a . css file with your own settings and load it after the Bootstrap . css. Would look like this: <!-- CSS DO BOOTSTRAP --> <link rel="stylesheet" type="text/css"…
-
1
votes1
answer128
viewsA: Input Mask in dynamic modal
Repeating id on the same page is wrong. An id must be unique, it is like an identification of an element, as well as a CPF where every citizen has his unique. If you have two elements with the same…
-
4
votes2
answers154
viewsQ: Is it possible to condition an operator += in a ternary?
I have an empty object: obj = {} I’m trying to check if there’s a key op1 in that object. If there is I want to add the key and any value, getting like this: obj = { op1: 10 } // O valor 10 é…
-
0
votes2
answers31
viewsA: Question: Ajax access object
It seems to me that the date has an index [0] with arrays, so you have to do the . each in the return index [0], and not at the root in the array: $.each(data[0], function(key, value) { ↑↑↑…
-
0
votes2
answers54
viewsA: JS to add online checkbox
You can create an object with the sums for each different vendor. Say you put in name of each checkbox a different supplier: <input type="checkbox" class="dias" name="dias_f1[]" value="5">…
-
0
votes2
answers98
viewsA: How to color the CSS header?
When a margin element (in your case, the h1) is inside an element without border or padding, the margin is applied outside the parent element. That’s what’s happening to you. The h1 has a standard…
-
0
votes2
answers176
viewsA: How to recover all data from a datatable column after a search has been done?
You can use a .each() jQuery and grab data from a particular table column: var dados = []; $('#tabela tbody tr').each(function(){ dados.push(this.cells[0].textContent.trim()); }); This will add in…
answered Sam 79,597 -
0
votes1
answer49
viewsA: Leave body child element without opacity
As the div that you do not want to be transparent is direct daughter of the body, you can create a class so that all direct child elements of the body are transparent, except the div in question,…
javascriptanswered Sam 79,597 -
0
votes1
answer42
viewsA: Assign CSS value within JS
This does not work because JS does not have access to pseudo-elements. The JS manipulates the DOM and pseudo-elements are not part of the DOM (as its name says, "pseudo" is something that does not…
-
0
votes2
answers63
viewsA: Close submenus by clicking another
You could simplify the code by creating only one class for all toggle, without having to create a click event for each class, but to solve the problem in question, just add the code below, which…
-
0
votes1
answer82
viewsA: Return Undefined in html for JSON object request
The return data is an array of objects, where each object has an index. Doing only, for example, data.photo will return undefined because the object data returned in fetch does not own the property…
-
1
votes2
answers69
viewsA: How to make a link of the child element open when clicking on a div?
You could do a directing via Javascript, but then lose the function of opening the link in a new tab that links <a> have by right clicking mouse: $(function(){ $(".readmore") // seleciona o…
-
0
votes2
answers140
viewsA: Add an action to a <select>
Have errors in your HTML: id="Assunto " name="Assunto " These spaces after Assunto in the id and in the name give difference in the time to manipulate them and will give problem. Remove them getting…
-
2
votes1
answer65
viewsA: How to use the while command to show the lowest value typed by the user?
You can do it this way: var numero, menor; while(numero != 0){ numero = +prompt("Digite um numero: "); if(numero == 0){ document.write("Menor valor digitado é: ", menor ? menor : "nenhum número foi…
javascriptanswered Sam 79,597 -
2
votes1
answer55
viewsA: I can’t click the menu link
You can’t because the menu is under the div where you have this animation, which is the div.animation-area, who owns a z-index of 9999, standing on top of everything. You will resolve by changing…
-
1
votes2
answers187
viewsA: make a Ubmit button of this type
With CSS you can make this button and the internal arrow of it. Just use pseudo-elements ::before and ::after. One builds the arrow rod and the other the right arrow. See below the code and comments…
-
0
votes2
answers77
viewsA: Remove span added with checkbox
I’m not sure I understand, but if you want to insert and remove one span in a li according to the checkboxes marked, just use a else in the if within the for and use .removeChild(). When browsing…
-
0
votes2
answers325
viewsA: Add records from a field and display in PHP (values have R$ in front)
I suggest working with monetary values in a column type INT and save the values in cents. For example, R$10 (or R$10,00) you save with the value 1000 (thousand cents). By pulling the column value,…
-
0
votes1
answer103
viewsA: Compare real values and inject value into input with Jquery
1.000,00 is considered to be less than 25.00 because in Javascript the decimals are separated by a point, that is, 1.000,00 is the same thing as 1.00 or just 1, which is less than 25. You can solve…
-
2
votes2
answers349
viewsA: How to center html blocks and keep them even after zooming in the page
Your div with position: fixed is related to body, and without specifying position with top, right, left or bottom she will be in the natural position, which is in the upper left corner of the body.…
-
1
votes1
answer135
viewsA: Autocomplete taking data from a json of a url
Before it was coming as an array and now as a JSON. So you should use a function in source receiving Response as JSON and returning the array within objects, filtering the array with what was typed…
-
3
votes2
answers110
viewsA: How to edit a li with Javascript?
A first problem is that you are adding the event click to the whole list: let lista = document.querySelector('.lista'); If you click off a LI but within the UL, will trigger the event and the result…
javascriptanswered Sam 79,597 -
1
votes1
answer518
viewsA: How to use this Modal bootstrap more elegantly?
You really should do everything using Bootstrap methods. For example, to open the modal, you use the attributes data-toggle="modal" data-target="#confirma" on the buttons, and not capturing a click…
-
1
votes1
answer53
viewsA: How to padde an <li> item vertically hide 100% of the container?
Place display: flex in everything: nav, ul, li and a (it is good to create classes for these elements, otherwise it will affect the whole site). Use the property align-self: stretch; in ul. This…
-
2
votes2
answers114
viewsA: convert one-dimensional array to associative multidimensional
You can do it in a simpler way using for: $dados = array(1,"1minuto","seco",2,"3minutos","chuva"); for($x = $index = 0; $x < sizeof($dados); $x+=3, $index++){ $array[$index]['volta'] =…
-
1
votes2
answers44
viewsA: Removing the CSS class according to screen resolution
Could use both events at the same time using the method .on(): $(window).on("scroll resize", function () { Just put the events separated by a space as shown above. But it doesn’t make much sense to…
-
1
votes3
answers62
viewsA: When displaying the site on mobile, the input with Submit defaults. How to solve ? I am using bootstrap 4
Your menu is only expanded on lg (navbar-expand-lg), correct? Then you can just put the margin ml-4 input when the viewport is lg. Instead of ml-4, use ml-lg-4: <input class="form-control ml-lg-4…
bootstrap-4answered Sam 79,597 -
1
votes2
answers135
viewsA: How to vertically align awesome font icons?
Use flexbox on nav with the property align-items: center that the child elements will be aligned vertically in the center. Now, it is necessary to remove the float: right that will not work in…
-
3
votes1
answer75
viewsA: How do I remove or change the scrollbar from my navbar?
Just change the property overflow class .navbar of scroll for hidden: .navbar { position: fixed; background-color: var(--bg-primary); transition: width 600ms ease; overflow: hidden; } However, if…
-
1
votes1
answer34
viewsA: Draggable html image with Javascript
The plugin automatically wraps the images in a div. Apply the .draggable() Separate image div from other Ivs: $( function() { // o que tiver a classe menos imagens $( ".draggable:not(img)"…