Posts by Tobias Mesquita • 22,900 points
750 posts
-
1
votes4
answers4978
viewsA: Validating Date of birth
you can simply add 15 years to current date. var formulario = document.getElementById("formulario"); var nascimento = document.getElementById("nascimento"); var enviar =…
-
6
votes6
answers65532
viewsA: Sum in 2 inputs and appear in real time - Javascript
follows an implementation using the event input and allowing the choice of other operators. var campo1 = document.getElementById("campo1"); var campo2 = document.getElementById("campo2"); var…
-
11
votes2
answers1853
viewsA: How to convert an html string to jQuery object?
Very simple, just instate jQuery by passing HTML as parameter. var teste = $('<div id="minhaDiv"><span id="meuSpan">Span</span></div>').find("span").text();…
-
4
votes3
answers2496
viewsA: How to submit a form automatically and without refresh?
Just be careful with some details. Using while, you will be sending multiple requests per second, this can cause an overload on the server, and believe this is not legal. Since you do not want a…
-
3
votes1
answer372
viewsA: Insert data with LIST into ASP.NET MVC
When you make a request to the Controller, a new instance of the Controller is instantiated and with this you are creating a new repository together. Since it’s interesting to keep a Unitofwork for…
asp.net-mvcanswered Tobias Mesquita 22,900 -
5
votes2
answers1314
viewsA: Note Field Mask - 10 or 5.5
look, I’ll post a suggestion, where the mask always has a decimal place and only allows numbers between 0 and 10. var notas = document.getElementsByClassName("nota"); var onNotaInput = function…
-
3
votes1
answer712
viewsA: update page content automatically
if you want the modifications made to the css files to be automatically reflected on the page, I find it difficult unless you find a way to notify the browser that a new version of CSS is available.…
cssanswered Tobias Mesquita 22,900 -
3
votes2
answers135
viewsA: Array jQuery - Remove indices and concatenate html
Give you two pieces of advice: jQuery is not a mandatory tool to manipulate the DOM. You don’t need to recreate all the elements in order to remove a node. var submits = document.querySelectorAll("p…
-
2
votes2
answers246
viewsA: How to make a "Hello Word!" that way
try to do the following: function SGVsbG8gV29scmQh() { } var helloWolrd = function () { alert(atob(new SGVsbG8gV29scmQh().constructor.name)); } helloWolrd();…
-
2
votes3
answers2346
viewsA: How to find 2 or more words in a text using jQuery?
you can break the nomedFiltro in words making a .split(' '), then for each of these words you create a RegExp with the modifier i (case-insensitive) and checks whether the text to be tested passes…
-
0
votes2
answers165
viewsA: How to consult a table in a limited (partial) way?
If the DBMS concerned is Oracle, the Sql Server or the PostgreSQL, you can use a CTE with ROW_NUMBER: WITH cte_rank AS ( SELECT ROW_NUMBER() OVER (ORDER BY pontuacao DESC) AS pos_rank, nome,…
-
3
votes3
answers11115
viewsA: Javascript to remove accents and special characters does not work the same in all browsers ?
look, you can use script fold-to-ascii to remove special characters and accents. Instead of using the event onblur, onkeyup and onkeydown, use only oninput, because it is triggered whenever the user…
-
0
votes1
answer236
viewsA: Capture Iframe input data
Let’s say you have two websites in different domains, where the customer access the dominio1.com and it has an iframe pointed to the dominio2.com. For the domain dominio2.com send a message to…
html5answered Tobias Mesquita 22,900 -
2
votes4
answers2318
viewsA: H1 stylized with center edge with css
There is an excellent tutorial on the subject in the following link: Create Headings with Lines in CSS Of the solutions proposed, my referred is using Flexbox: h1 { display: flex; flex-direction:…
-
9
votes5
answers19009
viewsA: How to keep the footer always down there
you can fix an element at the end of the page using position fixed or absolute and set the bottom for 0px. Follow an example with header and footer fixed and the section with fixed width and…
-
1
votes3
answers1664
viewsA: Abbreviate content inside cell (HTML table)
The simplest solution is to use only CSS, in this case a combination of display, white-space, overflow and text-overflow The Javascript function is only used to copy the text of the cell to the…
-
2
votes1
answer35
viewsA: Error with LEFT JOIN on LINQ
you cannot access a property of a Null object, in case the gr, but I believe that IdCategoria, Categoria and IdProduto are properties of c, then do so: var lst = from categoria in…
linqanswered Tobias Mesquita 22,900 -
1
votes2
answers43
viewsA: Retrieve and Print selected value of a <select>
you can use the event change for this. var resultado = $("#resultado_team2_CSGO"); var teste = $(".teste"); resultado.on("change", function (event) { teste.html(event.target.value); }); <script…
jqueryanswered Tobias Mesquita 22,900 -
3
votes2
answers6021
viewsA: Check if a file has been selected "input file"
you can use an HTML5 validation <form> <div> <input type="file" required /> </div> <div> <input type="submit" value="enviar" /> </div> </form> or…
-
6
votes2
answers7485
viewsA: Datepicker with Angularjs
The dateChange event returns a date and not a string, if you want to display a string with the local date, use the method .toLocaleDateString(). angular.module('app').directive('datepicker',…
angularjsanswered Tobias Mesquita 22,900 -
4
votes2
answers768
viewsA: Chaining of asynchronous requests
you can use the $q. all to wait for all the var promises = objetos.map(function (o) { return Enviar($q, o); }); $q.all(promises).then(function(){}); recalling that the .then() returns a new promise,…
-
0
votes4
answers1318
viewsA: Disappear Button From Side
I will propose a solution where you create a "link" between the two button, to forge such a link, I will use a data custom, in the case data-toggle-for. var toggleFor =…
javascriptanswered Tobias Mesquita 22,900 -
2
votes1
answer129
viewsA: Problem with Ajax request in Javascript
you have to mount the request within the callback function of AJAX. atualizarTabela: function (tx, results) { var len = results.rows.length; if (conectado == 1) { Verificação se existe conexão com…
-
2
votes1
answer162
viewsA: How to check items in Hover?
I will propose an alternative solution only with css: .carousel-gallery-item { float: left; padding: 3px; -webkit-filter: grayscale(0); -webkit-filter: grayscale(0%); filter: grayscale(0%); filter:…
-
0
votes3
answers1242
viewsA: LINQ with Where condition using variable
Jedaias, if you have a dynamic or complex condition, perhaps it is best to use a method syntax instead of the expression syntax. say you have two optional filters, in the case name or age, could do…
-
1
votes3
answers496
viewsA: List json object returned by php
to post here a complement to William Urbano’s reply, with an alternative way to assemble the cards. var imagens = [ { "titulo": "Imagem 01", "descricao": "Lorem ipsum Culpa quis et", "img":…
-
4
votes3
answers119
viewsA: How to remove a link from a string in Javascript?
you can use this regular expression. var urlPattern = /(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?/g; var textoComUrl = "hey olha isso http://google.com/, legal né?"; var…
-
2
votes1
answer822
viewsA: Question on how to calculate time difference with special conditions
following, follows a possibility: In caso1 it is very simple, just subtract the beginning month of the end month and add 1. Already the case 2 it is necessary to know how many days has the beginning…
-
4
votes2
answers1231
viewsA: Change variable value in Ajax
as the AJAX method is asymchronous, the function return verificaExistenciaArquivo will occur before the return of AJAX. You can even set the property async: false of $.ajax, but this is not…
-
4
votes3
answers2089
viewsA: Calculate on which days of the week the days of the month fall
to take the total of days of the month, we can use a small Trick, which is to take the day 0 of next month. var month = document.getElementById("month"); var agenda = document.querySelector("#agenda…
javascriptanswered Tobias Mesquita 22,900 -
2
votes3
answers129
viewsA: Performing dual function not named in the declaration act of the same
Even if it were possible to perform these functions in this way in batch, there would still be a problem, a variable declared within a view is visible only within it, then in this case the variable…
javascriptanswered Tobias Mesquita 22,900 -
0
votes3
answers3438
viewsA: How to receive a pdf file via ajax?
look, since the expected answer is a blob, then it is interesting to make a request ajax through the Xmlhttprequest and set the responseType to blob. var uploadFile =…
-
0
votes3
answers2918
viewsA: Format a string with time
Look, the object of Type DateTime has the property TimeOfDay that returns a TimeSpan with the current schedule. So it is interesting to convert the value of the cell dtSolicitacao for a DateTime,…
-
3
votes2
answers3367
viewsA: Create play/pause button
Look, you don’t need jQuery for this, Javascript’s own API gives you full control over Video. var video = document.getElementById("video"); var play = document.getElementById("play"); var…
-
2
votes4
answers258
viewsA: Doing level calculation and experience with Javascript
I have automated the creation of levels, at each level it will ask 10% more than the previous one, and at every 5 levels I make an additional increment of 50%. follows an implementation, in case I…
javascriptanswered Tobias Mesquita 22,900 -
2
votes1
answer351
viewsA: js function does not run on Chrome, due to window.Event
the window.event and the window.event.srcElement are quite specific to IE, in this case you need to perform some checks to make the script compatible with other browsers. var teste =…
javascriptanswered Tobias Mesquita 22,900 -
0
votes2
answers468
viewsA: C# system integration with two web services
I am taking into account the following premise: Since a service by definition is passive, then your application should consult the first service, the answer of this request should serve as the basis…
-
0
votes2
answers1035
viewsA: Table Completion with List
you can assign a List directly to the Datasource of a Gridview, but whenever you modify your List you will have to force a Gridview update. So instead, I recommend using a Bindinglist. BindingSource…
-
2
votes1
answer293
viewsA: JSON Class Construction and Consumption
Note that you have a title for your Lomadeelink object. as you have not specified anything in your model, Json.NET will interpret it as a property. { "lomadeelinks": [ { "lomadeelink": {…
-
1
votes1
answer249
viewsA: problems with JS Handlebars
Denali, your problem is only of scope, once inside a block your scope becomes the current object, then to access the parent object you need to use ../ to climb a level: var arraySeq = [1,2,3,4]; var…
-
1
votes3
answers1384
viewsA: Turn Audio & Video into Base64
would like to post an alternative, in case converting a Blob into Base64. var uploadFile = document.getElementById("uploadFile"); var btBase64 = document.getElementById("btBase64"); var taBase64 =…
-
1
votes3
answers285
viewsA: How to serialize a class to file in C#?
you can implement using Datacontract: Your class with the attributes DataMember and DataContract [DataContract] public class MyClass { [DataMember] public int MyNumber { get; set; } [DataMember]…
-
4
votes2
answers1576
viewsA: How to Create Conditional on a DIV p/ Change Content
Look, you can do this using a Zurb Foundation resource, in case the Interchange, as the Zurb is all modular, you can download only it. To download the same, just go on the following link and leaves…
-
0
votes3
answers1782
viewsA: Enable and disable an event without deleting and recreating it
follows an alternative using an eventHandler: var eventHandle = { flag: 0, elements: { input01: document.getElementById("input01"), input02: document.getElementById("input02"), input03:…
-
0
votes2
answers133
viewsA: get original HTML entities with javascript
just complementing, since the content is obtained externally, you can require it through an ajax request var external = document.getElementById("external"); var innerHTML =…
-
5
votes3
answers1766
viewsA: How do I get the column number of the table where an input I’m writing is?
you can turn your collection of inputs into a list, so look at the input input input inside this list: var campos = document.querySelectorAll(".campo"); var colunaAtual =…
-
1
votes2
answers162
viewsA: Delete selected input from an array with jquery condition
you only need to search for input:hidden with value equal to source of img within the div.img that contain the button.remover-img clickado: var source = document.getElementById("tmpl").innerHTML;…
-
0
votes3
answers3404
viewsA: Force popup opening on a website, after onclick, in javascript
an alternative is to add a layer blocking the entire page, once it is clicked, the popup will be opened and the layer removed. var createPopupTrigger = function (url, width, height, autoOpen,…
-
3
votes1
answer145
viewsA: Javascript code is giving error
pnet, I think you misunderstood my suggestion, I will post here a prototype of your code with the proposed changes: Asp file. <script type="text/javascript"> var asp = {};…
-
1
votes3
answers284
viewsA: Div with fixed position on the screen within the boundaries of another div
I made an example here that maybe is what you want. var header = document.querySelector("header"); var footer = document.querySelector("footer"); var bloco = document.querySelector("#bloco"); var…