Posts by Leandro • 1,764 points
90 posts
-
0
votes1
answer73
viewsA: Radio change input value Time
A possible way to do this would be by using the method change of jQuery, as shown below: jQuery(function($){ $('.entradasaidafolga').change(function(){ var campo = $(this).val(); if (campo ==…
-
2
votes1
answer46
viewsA: Run Jquery on multiple inputs
I believe the script below meets what you want: $('.plus').click(function() { //Pega o valor do input que está na mesma div do botão clicado var valorAtual =…
-
1
votes2
answers1197
viewsA: It is possible to know that an option has been selected in javascript event
Following is an example where you can define different actions for each option of select user-selected. $('#marca').change(function() { var marca = $('#marca').val(); switch (marca) { case '': alert…
-
4
votes2
answers547
viewsA: Remove text after JS character
Just use the method split() to cut the string at the first occurrence of the asterisk, as shown below: var resultado = nome.split("*", 1); In the above code, the first method parameter split() is…
javascriptanswered Leandro 1,764 -
0
votes1
answer215
viewsA: Calculate with comma and dot with Jquery
Try to make the modifications below in your code that will work as desired. $('input[type="text"]').keyup(function(){ //Receber os 2 valores, substituir vírgulas por ponto (replace) e converter para…
-
2
votes3
answers736
viewsQ: jQuery - Field with maximum 4 digits and complete with 0 left
I need a field where 4 numbers can be entered at most, and if the user enters less than 4 digits, the 4 digits are completed with zeros on the front, and does not accept values such as 0, 00, 000 or…
-
1
votes1
answer719
viewsQ: How to view PDF in pop-up when clicking link using html/css only?
On a given page of a website, I have an image with a link pointing to a PDF file. As it currently stands, when the user clicks on the image, the PDF file opens in another browser tab. But I need to…
-
1
votes1
answer35
viewsA: Video does not appear at the bottom of the site
I believe the problem with your code lies in the following points:: 1º In the line that receives the random video of array you ask him to take a random position up to 7, however, like your array has…
-
1
votes1
answer54
viewsA: How to get the result of the sum of two float values when clicking an input?
I believe that in this way it solves its problem, its code only had to basically have written the value of the result in the input concerning the result: function somarValores(){ var s1 =…
-
2
votes3
answers4043
viewsA: Field Percentage in HTML
This percentage mask would really only be for visual effects right? The closest solution I could find was this using only html and css, make sure this meets what you need. label, input { position:…
-
0
votes1
answer2137
viewsA: Uncaught Typeerror: $(...). validate is not a Function
Is there any fault in the path set to the file .js of jQuery, so is being presented this error, maybe the path to the file has been placed incomplete and the browser is unable to find the file.…
-
0
votes2
answers26
viewsA: How to remove Divs from an image list with jQuery?
I believe that the script below does what you want: $("#reverter").click(function() { $(".resize").each(function(){ var content = $(this).html(); $(".images").append(content); $(this).remove(); });…
-
1
votes3
answers109
viewsA: Run Ajax script automatically
There are several possibilities in this case, one of them would be to use the event onfocusout, that is, after the user fills the field and takes the focus of it, the function will be executed.…
-
1
votes1
answer43
viewsA: datepicker with concatenated name
Try it like this: var v_id = <?php echo $v_id; ?>; //criar uma variável para receber esse valor vindo do PHP $('validade_T'+v_id).datepicker({ //concatenar a variável criada Here is an example…
-
1
votes4
answers1294
viewsA: Hide or display HTML table line with Jquery
Would that be what you wish to do? $('#filtro-uf').change(function() { var estado = $('#filtro-uf').val(); if (estado == ""){ $('tr').show(); } else { $('tr').show();…
-
0
votes5
answers6090
viewsA: Autofocus: position the cursor at the end of the value
I believe using exclusively html cannot move the cursor to the end of the text by focusing on the input, follows solution with jQuery: var input = $("#teste"); tmp = input.val();…
-
4
votes2
answers6239
viewsA: Problem turning input text into uppercase letters
Try following the example below, changing the event on for change, I believe that this will work as intended: $("#texto").change(function(){ $(this).val($(this).val().toUpperCase()); }); <script…
-
2
votes2
answers2216
viewsA: problem with Jquery-Mask
I recommend using the plugin jQuery Masked input, he’s better than the mask plugin. Example of the use of masked input working with a similar CPF and CNPJ scheme in a single field:…
-
0
votes3
answers49
viewsA: Capture input value (Only numeric fields) and put in Div
Try it like this: $( "#testar" ).click(function() { var valor = $('#txtDistancia').val().replace(/[^0-9^,]/g, ''); $('#valorkm').html(valor); }); <script…
-
0
votes2
answers44
views -
1
votes3
answers588
viewsA: hiding component input when selecting a value in the select field
Here’s an example of how you could do this with jQuery, the basic difference will even be that instead of putting the values already predefined in options as I put in the example below, you will…
-
0
votes2
answers38
viewsA: Hiding and showing tab inside a modal using check
Try it like this: $("#check").click(function(){ if($(this).is(':checked')){ $("#tabEstrangeiro").css("visibility","visible"); $(this).val("true"); } else{…
-
0
votes5
answers47771
viewsA: Centralize a table (HTML)
One of the possible solutions to centralize the table would be to define the CSS the left banks (margin-left) and right (margin-right) table with value auto: .table{ margin-left: auto; margin-right:…
-
6
votes4
answers190
viewsA: What is the default value of the "cursor" attribute?
The default value is default: .exemplo { cursor:default; } The following is an example of possible values for the attribute cursor, just pass the mouse cursor over each one to view how they work:…
-
1
votes1
answer9717
viewsA: Remove data from a div with Jquery
Here are some examples of how to remove a div or remove the contents thereof: 1st Remove the div by clicking button using the method remove(): $("#removerDiv").click(function(){…
-
4
votes1
answer201
viewsA: How to clear an input when clicked?
I believe the easiest way to do that would be to use the attribute placeholder of html: Name <input type="text" name="name" placeholder="insert your name here"><br> When the user starts…
-
0
votes2
answers956
viewsA: Hide a div containing photo and show another div in the same place
To hide a div, just use the method .hide() and, to display the div which is hidden, use the method .show(), as an example below: $(function(){ $(".btn-toggle").click(function(e){ e.preventDefault();…
-
0
votes3
answers1717
viewsA: Picking up the label text only if there is a label
Try it like this: $("#etapa3").find(".form-group").not('.well .form-group').each(function(){ if ($(this).find("label").text() != ""){ console.log($(this).find("label").text()); } }); <script…
-
0
votes3
answers134
viewsA: How do I allow only digits in an input field?
Modify the following line: $('input').bind('keypress', function (e) { To: $(document).on('keypress', 'input', function (e) { Doing this, the function that checks whether it was typed only digits and…
-
2
votes3
answers1667
viewsA: Show input when user selects option
The following is an example of one of the possible ways to hide/display the label and the input according to the option selected by the user: $('#status').change(function(){ var valor =…
-
1
votes2
answers509
viewsA: jQuery apply function to all div with the same name
To apply the function to all divs with even name just do the following: $("[name=nomeDiv]").evento(function(){ //Código da função }); In this case, the function will be applied to all divs with name…
-
2
votes2
answers3042
viewsA: Increasing/decreasing number effect
I know the question has already been answered, but anyway follows example of another way to do this with the numbers in ascending and decreasing order to increase the knowledge base:…
-
1
votes4
answers6294
viewsA: Mask with Jquery changing from fixed to mobile or vice versa
Another possible solution, instead of comparing the size, would be the following: jQuery(function($){ $('.tipo').change(function(){ var campo = $(this).val(); if (campo == "fixo"){…
-
3
votes1
answer863
viewsA: Make a select and checkbox to have a behavior similar to radio button
That’s what you need? $(document).ready(function(){ $(document).on('change', ':checkbox', function(){ //Verifica se o checkbox clicado está checado if($(this).is(':checked')){ //Desmarca os demais…
-
1
votes4
answers3827
viewsA: Percentage Mask
An alternative would be to do so: jQuery(function($){ $("#edtPercentual").keyup(function() { //Obter o primeiro caractere digitado var temp = $(this).val().charAt(0); //Verificar se o primeiro…
-
4
votes3
answers85
viewsA: Jquery ischecked does not work
It is working normally, follows example displaying a alert according to the state of ckeckbox and with jQuery 1.8: function Filtra() { var respondeu = ""; var valor = $("#responderam").val();…
-
2
votes2
answers83
viewsA: Locking in field in Div Occult
Try it like this: function Mudarestado(el) { var display = document.getElementById(el).style.display; if(display == "block"){ document.getElementById(el).style.display = 'none'; //Desabilita todos…
javascriptanswered Leandro 1,764 -
1
votes1
answer1034
viewsA: I would like to place two actions for the same form
If what you want is to change the attribute action of form according to the button clicked, follows example using jquery: $("#btnenviar1, #btnenviar2").click(function(){ //Recebe o id do botão…
-
0
votes4
answers130
viewsA: How to apply a rule to a specific element?
Create a class specifies for that image and applies the desired style in class created, as an example below. In doing this the style defined will be applied only to the image associated with class…
-
1
votes0
answers146
views -
1
votes3
answers110
viewsA: Visited in tr table
Would that be what you want to do? $("tr").click(function() { $('tr').not(this).css({"background-color": "white", "color": "black"}); $(this).css({"background-color": "#6495ED", "color": "red"});…
-
0
votes2
answers70
viewsA: Verficar buttton radio
$('#teste').click(function(){ var valor = $('input[name=area]:checked').val(); if (valor != null){ alert ("Opção selecionada: "+valor); } else { alert ("Selecione uma opção!"); } }); <script…
-
0
votes1
answer336
viewsA: How to click on a link and make an element invisible using CSS only?
Would the form below meet your need? figure.pop-up-principal { position: fixed; width: 100%; max-width: 430px; max-height: 283px; height: auto; margin: 0 auto; top: 0; bottom: 0; left: 0; right: 0;…
-
2
votes3
answers114
viewsA: headers Block size
Try it like this: header{ border: 1px solid black; border-radius: 10px; float: left; } h3{ display: inline; } <header> <h3>Bem Vindo ao Portal do Cliente</h3> </header> Or…
-
1
votes2
answers408
viewsA: how to change the <H2> to <H1> via jquery
You can also do as follows: $('#botaoAlterarTag').click(function() { $('h2').contents().unwrap().wrap("<h1 class='titulo'>"); $('.titulo').load(); }); <script…
-
1
votes2
answers2085
viewsA: Fix Double Click Buttons with Jquery
Try it like this: //Desativar o botão ao clicar $(":button").click(function() { $(this).prop("disabled",true); }); //Reativar o botão após 3 segundos $(":button").click(function() { var btn = this;…
-
1
votes2
answers2231
viewsA: Hide table columns when resizing html page
You really wanted to do it with bootstrap or JavaScript? Only with CSS pure you can do it. Follow example: @media screen and (max-width: 442px) { table th:nth-child(3) { display: none; } } @media…
-
1
votes7
answers5040
viewsA: Regular expression for accepting numbers and letters, regardless of sequence
As stated here, only with regex it will be difficult to encompass all the possibilities, therefore, follows two ways to do this: 1st form: in this detail a little more to know how many letters, how…
-
2
votes2
answers319
viewsA: Select combobox from a click on the table row
I made some modifications to the code, I believe it works like this: var setores = [ {"id":"1", "setor":"Recepcao"}, {"id":"2", "setor":"Pronto Socorro"}, {"id":"3", "setor":"Unidade de Internacao"}…
-
3
votes4
answers1037
viewsA: Capture form data and transform to UPPERCASE
Try it this way: jQuery(':input').keyup(function(){ $(this).val($(this).val().toUpperCase()); }); $('.form').submit(function () { //serializando os campos do formulário var dados =…