Posts by Mathiasfc • 5,837 points
148 posts
-
2
votes2
answers105
viewsA: How to create regex that only accepts characters without accents
You can use the attribute pattern of input, using the regex [A-Za-z ]*... <form action="..."> <input name="username" id="username" type="text" pattern="[A-Za-z ]*" title="Somente letras sem…
-
1
votes1
answer387
viewsA: Materialize Javascript autocomplete
From what I’ve researched, autocomplete does not yet have a feature to display suggestions only after certain user input. I saw that it is in the plugin’s upgrade list. "When the user enters "@"…
-
2
votes1
answer425
viewsA: Apply jQuery mask to Modal
The way you apply the mask is correct, the problem is in the way you define the element on which the mask will be applied. When using the method .find() you are looking for descendants of the…
-
1
votes0
answers1200
viewsQ: How to finish process 'Chrome.exe' when finishing script execution
I implemented a script using Selenium that accesses some pages. The code is working exactly as expected. My problem is when script finishes its execution which happens in two ways: When the user…
-
0
votes1
answer447
viewsA: Align radio button mobile
I made some small additions to your code, try whenever possible to use the classes that bootstrap provides, this will make these "breaks" do not happen. Another important point is to take care not…
-
1
votes1
answer62
viewsA: How to detect the source(file) of a function through the developer console?
In the Chrome, has the option to go to the function setting in the console itself. Already in the firefox I could not find a way to go to the function declaration through the console, but we can…
javascriptanswered Mathiasfc 5,837 -
1
votes4
answers2632
viewsA: What is the equivalent of CSS media queries in Javascript?
I believe that there is no equivalent solution in javascript, however, there are ways to arrive at convenient results. The first form would be the combination of the event that detects changes in…
-
1
votes2
answers69
viewsA: Gradient diagonally in a circle
On the estate background in place of 0% I switched to 50% background: linear-gradient(135deg, rgba(0, 139, 206, 1) 50%, rgba(255, 255, 255, 1) 55%, rgba(255, 255, 255, 1) 100%); .cor1 { width: 29px;…
-
1
votes3
answers679
viewsA: How to redirect the 'interface' to a home page after a downtime?
The problem with your code is in window.location.reload = "initial_page.html", take a look at documentation p/ know better how the method works. The rest is working well, I translated the code and…
-
1
votes1
answer32
viewsA: Add a div in the middle of an image
I created a class .inner with the property transform to achieve this result. There are several ways to centralize a divin another, follows a question quite interesting from Soen which shows some of…
-
1
votes1
answer168
viewsA: Tag video inside Slick
I found an answer in Soen that probably solves your problem, I adapted a little the answer p/ to suit your context better. Knowing the video url is correct, you will need two events to sync the…
-
0
votes1
answer23
viewsA: Selection css in tables
You have to put the ::selection in the element that contains the text, in case you are assigning it to the tr, but the text is in td, then I believe this selector solves your problem: .hora…
-
2
votes1
answer35
viewsA: Multiple Upload Thumbnail
You have to declare all icons in the object icons, in the example below I added an icon to represent the image of a file of type image/png. Whenever there’s change in input an image is created for…
-
1
votes1
answer390
viewsA: Delete table row by checkbox
From to exclude with the following function: function removerItem() { ckList = document.querySelectorAll("input[type=checkbox]:checked"); ckList.forEach(function(el) {…
-
0
votes1
answer69
viewsQ: How to debug a code in Jsfiddle?
Is there any way to debug/debug a code on Jsfiddle? Usually in the Chrome development tools several scripts appear, which is the correct way to put breakpoints to debug the code? Is there any way to…
-
1
votes2
answers166
viewsA: Loading on top of the map
I don’t know if this is the best way, because I used css to position the Download on top of the map, maybe there may be some native way from google maps to add a download. I added the call to the…
-
12
votes3
answers4035
viewsA: Like writing a pseudocode?
As far as I know, there’s no rule for writing pseudocode, so there’s no way correct to write it, it should only be written in a simple way, so that anyone with minimal knowledge in programming can…
pseudocodeanswered Mathiasfc 5,837 -
1
votes3
answers114
viewsA: headers Block size
h3 { float: left; } <h3> Bem Vindo ao Portal do Cliente </h3>…
-
6
votes2
answers408
viewsA: how to change the <H2> to <H1> via jquery
This can be done using the function replaceWith, follows an example: $('h2').replaceWith(function() { return $("<h1>" + $(this).html() + "</h1>"); }); <script…
-
6
votes2
answers209
viewsQ: Is there a function that fills a string to a certain length?
I’d like to fill out a string until it reaches a certain length. There is some function capable of doing this? It would be something like the PadLeft(Int32,Char) and PadRight(Int32,Char) of the C#.…
-
7
votes2
answers209
viewsA: Is there a function that fills a string to a certain length?
From the Ecmascript 2017 (ES8), the following methods have been implemented: String.prototype.padStart(targetLength, padString) and String.prototype.padEnd(targetLength, padString), filling a string…
-
4
votes2
answers2231
viewsA: Hide table columns when resizing html page
There are bootstrap classes for this behavior. In your case, I suggest combining the classes .visible-md-block and .visible-lg-block, add them to the elements you want to hide in a resolution in the…
-
3
votes3
answers1419
viewsA: Clicking on <li> the <a> link also work
Try something like: $(document).on("click", "li", function() { window.location = $(this).find("a").attr("href"); }); ul { list-style: none; } li { width: 100px; background: gray; margin: 0 0 10px;…
-
4
votes1
answer716
viewsA: How to create a DASHBOARD like this?!
There are n ways to assemble this layout, follows a alternative that will give you a "north" of how to do those divs of the lines, I left an example of the basic structure of the layout, it is all a…
-
1
votes1
answer30
viewsA: Using active menu as input "radio"
I believe that making this link between the Buttons radios and the menu will cause more work, it will take events to keep both synchronized etc... Honestly I don’t see why create this scheme with…
-
2
votes3
answers2243
viewsA: Doubt random string with Javascript
Follows a alternative to randomly return the strings: function MariaOuJoao(){ var opcoes = ["Joao","Maria"]; alert(opcoes[Math.random() < 0.5 ? 0 : 1]); } <button…
javascriptanswered Mathiasfc 5,837 -
5
votes2
answers2478
viewsA: Check if button is disabled - Javascript
Notes that the method getElementsByClassName returns a collection, so to grab only the button, you can grab the first item in the collection or use an alternative such as getElementById, already…
-
3
votes1
answer168
viewsQ: How to skip all breakpoints without removing them?
Is there a shortcut/configuration to ignore all breakpoints without necessarily deleting them from the code?
-
1
votes3
answers118
viewsA: How to insert Javascript with Javascript?
One alternative would create the script according to the example below, and instead of insertAdjacentHTML() I used the method appendChild() var script = document.createElement("script"); script.type…
-
4
votes1
answer14089
viewsA: Remove Google Maps bus stops/locations
To hide the points of interest (POI’s) of your map, just add the following style in the map options: styles:[{ "featureType": "poi", "stylers": [{ "visibility": "off" }] }] To hide bus stops:…
-
1
votes2
answers351
viewsA: Validation of elements of a javascript array
I advise to do this validation using regex, follow the example: *This code validates the name as a whole, so if there is a number in the name will ask to type again: function formatar() { var nome =…
javascriptanswered Mathiasfc 5,837 -
4
votes1
answer280
viewsA: Select element, ignoring specific class
Da to capture it using selector :not filtering the div's who do not have the class .enviando, together with the dial :first to take only the first div. $(".lista…
-
1
votes2
answers2077
viewsA: Onkeyup event with Jquery
From what I understand, you want to replace the commas with dots in the event keyup, follows an example of how to do with jquery: $(document).on('keyup', '.virgula_nao', function(e) { var keycode =…
-
3
votes1
answer1880
viewsA: How to take the horizontal line from the table in bootstrap
One alternative to remove the edges would be so: table td{ border:none !important; } *Note that you need to use the !important to ignore the style assigned by the bootstrap itself, caring for that…
-
3
votes2
answers243
viewsA: How to style the <p> tag differently?
Follows a alternative styling only the element p, but without a doubt the solution with 2 elements, presented by @Sergio, is better, for compatibility reasons, responsiveness etc... p.acessorapido {…
-
1
votes4
answers456
viewsA: Take html from a created variable
You can do it this way too, only with javascript, creating the objects and later creating the html elements, p/ leave in the string format I used the attribute outerHTML, follows the example…
-
1
votes2
answers116
viewsA: Find attribute value with regex
Follow other alternatives to find the value, in the snippet below has an example using .substring(I know in the question you ask for regex) but I found it interesting to put, and an example using…
-
4
votes1
answer438
viewsA: How to lock cursor drive in Masked input?
I found a solution using jQuery quite interesting in the Soen that is not a property of Masked input plugin, but solve your problem: $.fn.selectRange = function(start, end) { if(end === undefined) {…
-
2
votes3
answers1889
viewsA: mark a checkbox and uncheck the others
I still think it would be better to use radio button, but orders are orders... Follow an alternative, to mark a checkbox is passed the id of the same by parameter to the marcaDesmarca(id) ai…
-
30
votes5
answers1273
viewsA: Why Nan Nan == 0?
According to the MDN: Nan - The global property Nan is a special value meaning Not-A-Number (not a number). According to the specifications Ecmascript 5 (index 9.5) and ECMA 262 (index 7.1.5), when…
javascriptanswered Mathiasfc 5,837 -
4
votes1
answer902
viewsA: Jquery window.open in "Success" in ajax is being blocked
Usually browsers block the method window.open when it is not a direct action of the user. One solution would be to open the window before calling AJAX and after AJAX’s response manipulated it, it…
-
7
votes3
answers1068
viewsQ: How to implement a "scroll Hijacking"
I have noticed in several modern pages a scroll behavior that goes up to certain interest part of the content, researching, I found that this type of behavior is called "Hijacking". The term…
-
1
votes1
answer72
viewsA: Help with Datetangepicker in jQuery
I did not delve into the events that the datepicker itself makes available, perhaps I have some more "correct" way of doing this. I simply detect the click on the datepicker, if after the click the…
-
1
votes3
answers605
viewsA: Calling the same function twice
Take a look at this fiddle: jsFiddle Opens popup’s according to the number of items in the array: var arr = ["http://www.google.com", "https://www.stackoverflow.com/"]; $("#links").click(function()…
-
4
votes2
answers3119
viewsA: How to perform a Js function when selecting a radio input
Follows a alternative using only javascript var rad = document.form.radios; var prev = null; for (var i = 0; i < rad.length; i++) { rad[i].onclick = function() { qualquerFuncao(this); } };…
javascriptanswered Mathiasfc 5,837 -
0
votes1
answer41
viewsA: Print the previous 30
Creates an auxiliary variable, while the value is greater than or equal to itself minus 30, printa and decreases the value by 1. The problem with your code is that at the same time you validate…
-
4
votes2
answers1687
viewsA: How to know if the scroll position is on top of a Section?
Just check if the scrollTop() is greater than or equal to position(). top of the section you want to check, the scrollTop() returns the current vertical position of the scroll bar, the…
-
1
votes1
answer40
viewsA: How to detect download event in audio and video tags?
There are ways, but from what I’ve researched, no solution seems to be as trivial as capturing an event. There is none event that detects if the user has downloaded the audio/video. Here is a very…
-
2
votes3
answers3321
viewsA: How to overwrite some bootstrap attributes?
Note that if you want to add style when width is minor which 768px, shall use max-width:768px. Here explains in detail the media queries. Another interesting fact would be to use !important p/…
-
4
votes2
answers693
viewsA: Tooltip Bootstrap 3 disappear when I click another
Follows another alternative solution, showing the tooltips manually Whenever the click event of an element that has tooltip is triggered, it hides all visible tooltips and shows only the tooltip of…