Posts by Mauro Roberto • 634 points
30 posts
-
3
votes2
answers1918
viewsA: Input Cpf and phone accept only number
You can use the plugin JQuery Inputmask. With it you can define the data format of a input. To define the format of the CPF, just use the following code jQuery: $("#frmCpf").inputmask({ mask:…
-
1
votes1
answer80
viewsA: My code does not run fully
You want all permutations that are of the type (i j k) such that i < j < k, correct? You won’t be able to do this using just one for. Note that when we set values for i and j, for example, we…
canswered Mauro Roberto 634 -
0
votes1
answer150
viewsA: Drag 'n drop from div with Collapse and position Fixed
You need to use a droppable to be able to drop an element inside it. In the element with droppable you can tell which elements it accepts (in the case of the example, it accepts elements with the…
-
3
votes2
answers697
viewsA: Error lvalue required as left operand of assignment
This problem is happening because you put = in their condition, rather than ==. The = is for assignment, when we want to compare two values we use ==. It’s not always a mistake to use = within a…
canswered Mauro Roberto 634 -
1
votes2
answers84
viewsA: Make field validation identify the user has purposely pressed the space bar
Just use trim values. This method returns the string without the beginning spaces and the end spaces. For example: " abc ".trim() will return "abc". When his string is formed only by spaces, the…
jqueryanswered Mauro Roberto 634 -
1
votes1
answer54
viewsA: Return result in an input
The estate innerHTML is to modify the html inside a tag. The value of a input gets into value and not in innerHTML, That’s why you can’t change. Another thing, you have no classes .cc-number and…
-
0
votes1
answer49
viewsA: Scroll through a JS object again after swapping the <option> inside a <select>
You don’t need an event change for each option of select, just create a single event and test the value of select within it. I made an example with the code you passed: const data = { "MG": [{…
-
0
votes1
answer388
viewsA: I can’t change the background of my body
This problem is happening because you forgot ; after @charset "UTF-8" in the first line of CSS. Just add that it will work normally. Something else, your div #interface is covering the body and is…
-
2
votes2
answers115
viewsA: How do you make the <div> with the <img> tag only appear after the photo is loaded?
You can use .show() jQuery to display the tag img. First you need to add display: none; image to hide by default. Then, in your onloadend just display the tag img using .show(). See the following…
-
3
votes1
answer131
viewsA: Count quantity shopping cart
The COUNT returns only the number of rows that meet the search criteria. What you need to use to add up the values of a column is the SUM. Your code would then look like this: $stmtCount =…
-
0
votes1
answer38
viewsA: Get Selected Index
Just pass the object you want to select within the method setSelectedItem. Thus: String [] s = {"orange", "pear", "apple", "banana"}; JComboBox test = new JComboBox(s);…
-
1
votes1
answer1033
viewsA: Truncate Value to two decimal places in PHP
You can do it like this: $numero_decimal = 6.495; $valor_pedido = floor($numero_decimal * 100) / 100; The value will be multiplied by 100 and made whole, making the two decimal places part of the…
phpanswered Mauro Roberto 634 -
0
votes2
answers170
viewsA: I can’t keep my footer down
I’ve made some modifications to your css and fixed the problem of footer. You had several elements positioned absolutely, including the #main. I just removed the style of #main, the…
-
1
votes4
answers295
viewsA: take only the decimal of a double
You can multiply the value by 10^n, in which n is the number of decimal places you want to show. Then simply subtract from that value the entire part, which is ((int) x) * 10^n. In your case, with n…
javaanswered Mauro Roberto 634 -
1
votes2
answers116
viewsA: Select options does not work using jquery
To get the selected value just use fiscalModule.value. And you don’t need JQuery for that reason. Follow an example: let fiscalModule = document.getElementById('fiscalModule'); fiscalModule.onchange…
-
0
votes3
answers406
viewsA: Screen forwarding after Load
You can do it using JavaScript. Just use a setTimeout on the loading screen to wait the time before redirecting and window.location to make the redirect. Follow an example: window.onload =…
-
0
votes1
answer92
viewsA: iframe with designMode get generated html inside the iframe?
You can access the content of iframe thus: iframe.contentWindow.document.body.innerHTML; and you can change the content like this: iframe.contentWindow.document.body.innerHTML = "<h1>novo…
-
1
votes1
answer326
viewsA: Multi-color background
You can do it using linear-gradient or a div positioned behind the elements. To do with gradient, you need to put twice each color indicating where it starts and ends. The gradient I used was:…
-
4
votes2
answers39
viewsA: how do I change the background color using Javascript?
Your code is almost correct. The problem is that you wrote the method name getElementById wrong way and forgot the quotes in the ID. The code should be:…
-
1
votes1
answer100
viewsA: Change span text by clicking
Hi. You can get the text that is appearing on span using $(this).text() within the event of click. Then just check if the value of the text is "open tags" or "hide tags" and change. To change the…
jqueryanswered Mauro Roberto 634 -
3
votes3
answers693
viewsA: I can’t make the sum of the first 100 prime numbers, where am I wrong?
There are some errors in your code: The cont has to be reset with each iteration; The condition of the second while should be primos >= num; The variable num should be incremented at each…
-
1
votes1
answer187
viewsA: Lines cards with large text on the same line
Hello. One way to solve this problem would be to add a clear:left; on all cards that start the line. This property will cause these cards to be added to a new line, with no effect on float applied…
-
1
votes1
answer33
viewsA: Save values and make a comparison
What you can do is add a tag for each button, create a variable selectedTag to store the tag from the selected button and use this to make the logic you need. Note the following code. private String…
-
0
votes2
answers37
viewsA: loophole
Hello. Your code does not work because the i used within the event of change is the same used in for. When the event is called, the value of i will always be equal to 10 (try to give a…
javascriptanswered Mauro Roberto 634 -
1
votes2
answers45
viewsA: How to submit form and how to leave without refresh
Hello. You need to put the parameter name in the attribute name of input. Is giving No arguments Provided! because there are no inputs with the names you expect on the server. For example, in the…
-
1
votes2
answers249
viewsA: How to view JSON data in jQuery Datatables via Ajax?
Hello. You need to include the jquery before your code. Simply change the order as follows: <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>…
-
0
votes1
answer174
viewsA: Difference between Divide and Conquer, Decrease and Conquer and Dynamic Programming
Hello! First it is important to note that all these techniques are based on induction. Divide and conquer is an algorithmic design technique that consists of dividing the problem into smaller…
-
2
votes1
answer88
viewsA: Positioning <p> on one side and img on the other
Hello. You are wearing display: flex; in the #topo, so you’re not able to position with float. Your flexbox is in column mode, so all elements will be in a single column. What you can do is add…
-
1
votes1
answer92
viewsA: Make ul move using script only
Hello. I made some modifications to your code and added a script that I believe does what you want. I didn’t use the idea of margin that you quoted, I did using a class active to show/hide an item.…
-
1
votes2
answers317
viewsA: JS: Add an icon to an event to change the background and bring up content
Hello. You can use a class .active to indicate which icon and what content is active. Then simply remove/add this class when there is a click. You can also use the property data-target to indicate…
javascriptanswered Mauro Roberto 634