Most voted "jquery" questions
jQuery is a Javascript library focused primarily on DOM handling, event management and Ajax, seeking to free developers from directly dealing with a number of browser compatibility issues.
Learn more…11,371 questions
Sort by count of
-
10
votes2
answers910
viewsCount the amount of characters changed in an input field
On a given page for changing registered data, in one of the fields you need to limit the number of characters that can be changed. There are 2 fields inputs and one of them is hidden by storing the…
-
10
votes1
answer5204
viewsWhat is the difference between . on(), . click(), . Blur(), bind()?
And if there is one more, what would it be? And the difference of that "some more" to the others above. Note: I know you have, I’m not saying you don’t have, if someone in a didactic way can answer…
jqueryasked 7 years ago Lucas de Carvalho 6,427 -
10
votes2
answers1469
viewsDynamically Update php Session with jQuery
Well, I have the function below that, with Jquery, I update the cart values display labels. Everything works: function add(_quant, _preco, _total, _estoque) { quantidade =…
-
10
votes2
answers256
viewsHow to print only the first 5 characters?
I need it to be displayed up to a maximum of 5 characters of the contents of each table cell in a specific resolution. I don’t know if there are any Pseudo Elemento do what I need, something like:…
-
10
votes3
answers828
viewsSeparate typed words within an input
I have a input, where the user enters his or her full name from the following code: <input type="text" id="fullname" name="fullname" title="fullname" maxlength="255" class="input-text fullname…
-
10
votes4
answers333
viewsHow to manipulate these objects with Javascript?
I have the following objects: { letter: "A", num1: "1", num2: "2", num3: "3" } { letter: "B", num1: "3", num2: "2", num3: "1" } { letter: "C", num1: "2", num2: "3", num3: "1" } I would like to…
-
9
votes3
answers14251
viewsSelect elements containing a particular "date" attribute
On the page there are several elements with attributes data. To avoid going around adding CSS classes to the elements, making page code denser, I would like to select elements by attribute name…
-
9
votes7
answers31206
viewsHow to insert data into DB with jQuery/Javascript without using PHP?
I am learning Javascript and jQuery and I am wanting to make a small site to test the insertion of data in a database. I have no knowledge in PHP, I wonder if it is possible to insert data in a…
-
9
votes7
answers16282
viewsUnderstanding the JSON file
I have a code similar to this on Jsfiddle. On my home WAMP server I did to try working with JSON (Jsfiddle does not contain the JSON file to test). In a question I asked about how to insert data…
-
9
votes1
answer4824
viewsJavascript code documentation standard and automatic documentation generation on Ides and exportable
Java has the Javadoc, PHP has Phpdoc and other languages, has documentation standards. Which standard most used to document javascript, already integrated with Ides, so that when using functions, it…
-
9
votes6
answers2374
viewsHow to select all "empty" elements
Is there any way to select all the empty elements of a page? For some reason that I cannot explain, the code below does not select the input without text on my page: $("input[value=''],…
-
9
votes4
answers14813
viewsI need to lock Ctrl+v in a text box
I want to create an input type="text" which does not allow them to glue anything to it. You do not need to present any alert or anything like that, just don’t allow the necklace.…
-
9
votes3
answers1752
viewsHow to take the current position of a div by his class?
For example: <div class="container"> <div class="position"></div> <!-- Essa tinha que ser position [0]--> <div class="position"></div> <!-- Essa tinha que ser…
-
9
votes2
answers835
viewsHow to make an effect by adding a new item to a list
I have a list that updates from time to time and would like to add an effect equal to this site: Website It’s the list that’s in the middle of the site. Where, when a new item enters the list, the…
-
9
votes3
answers465
viewsHide image generated by Javascript
I am using the sharethis plugin to share content on social networks. For this I am making the following call: <script type="text/javascript"…
-
9
votes4
answers601
viewsInternal navigation with Jquery
I have the following structure in my header: <header> ... <div id="header-reserva" class="cf"> <a href="#header-reserva-iframe" class="scroll">Reserve aqui!</a> </div>…
-
9
votes2
answers991
viewsHow to select element in the lowest hierarchical level?
I need to select the ul parent of the element li that is being clicked. But as a li is inside the other javascript understands that I am clicking on li and in all li parents. <ul…
-
9
votes2
answers2006
viewsProblem with delay in jquery
The delay of this function in jquery is not getting, wanted to know the reason, or another way to make a delay in it. $("header").delay(1000).css("display", "none");…
-
9
votes1
answer343
viewsHTML5 video without context menu
How to disable the right mouse button context menu in videos, so the video menuzinho does not appear? $('#nome').contextmenu( function() { return false; }); The above code, but does not work in…
-
9
votes2
answers4878
viewsJavascript function does not wait for another to start
Problem My role is not waiting for the other to be finished so it can continue, for example: Example: function buscando_dados(){ $.post('ajax.php',{},function(dados){ alert(dados); }); } function…
-
9
votes1
answer25431
viewsHow to make a click shoot another click?
I wonder if there’s a way to click on an element by clicking on another place, something like this: jQuery $("#button1").click(function(){ $("#button2").click(); }); I tried that and it didn’t work.…
-
9
votes2
answers3245
viewsRecord audio and stream live
I need to record audio and broadcast live, I found that with HTML5 and Javascript/jQuery is possible and that has plugins that can help me. I’m wearing one of them, the Mediastreamrecorder and I’m…
-
9
votes4
answers2358
viewsHow to count how many times a value appears in a table
How to count how many times a value appears in a table ? Example: <table id="table"> <tr> <td> 2 </td> </tr> <tr> <td> 6 </td> </tr> <tr>…
-
9
votes2
answers11971
viewsHow to count selected checkbox quantity
I’m trying to make a code that checks how many checkboxes are checked by clicking a button, because I’m making a system that duplicates records. I have a list with several checkboxes, and when the…
-
9
votes2
answers19079
viewsFind Scroll Position of a Particular Object
It is possible to know the position of the scroll of a given object through pure Jquery or Javascript? tried var posobj = $("#meuobjeto_id").scrollTop(); However, the obtained value is always 0. Any…
-
9
votes9
answers2096
viewsHow to assign a function with parameters to click without executing it?
Explanation: I have an application that has by default an event mostraGrupos() and when it is executed, at the end it detaches itself from the element and tries to assign the function…
-
9
votes3
answers7855
viewsPrevent user from pasting special characters
I am creating a system in which the user must type in a input the mother’s name with only alphanumeric characters. I am using the code below that is working, but I noticed a flaw. Even allowing not…
-
9
votes2
answers1726
viewsHow to replace multiple using variable as first parameter?
When I want to replace all occurrences of a string I do so: var ola= "ola mundo ola mundo"; ola = ola.replace(/ola/g, "xxx"); Result: "xxx world xxx world"; But I want to use a variable instead of…
-
9
votes2
answers3677
viewsHow to disable mouse scroll button?
I would like to know how to disable the central button of mouse who has the scroll? I don’t want to take the scroll just the button of scroll of mouse that features arrow to left up and down when…
-
9
votes1
answer303
viewsUse local files if CDN is Offline
I wonder if it is possible to perform a callback if a CDN is offline the system uses local files. Ex: I use the Fontawesome CDN but if the user runs out of the internet or the CDN goes offline, it…
-
9
votes3
answers1392
viewsHow to integrate Angularjs with common scripts?
My doubt started when I tried to use the Carousel twitter bootstrap inside an Angularjs project, it didn’t work at all. I found the angular-ui, solved my problem using this component, but my doubts…
-
9
votes2
answers16374
viewsWhat is the difference between Ajax dataTypes in jQuery?
I am learning jQuery and I need to know the difference between Ajax dateTypes. dataType: "xml" dataType: "json" dataType: "script" dataType: "html" How this influences the execution of the script…
-
9
votes4
answers268
viewsHow to improve this jQuery code?
I’m learning jQuery and I don’t always know exactly how to develop the code more cleanly, semantically, I’ll end up learning. How could I improve this code? $("#click_apoio").on('click', function(…
-
9
votes2
answers23399
viewsPicking up parent div attributes through child elements
I own several structures that follow a unique style: <div data-id="1"> <div> <button>Descobrir é o data-id desta estrutura</button> </div> </div> with jQuery or…
-
9
votes1
answer375
viewsHow $.when() and . then() aligned works
In my studies of javascript with Jquery framework, I have come across several times with $.when() and .then() aligned. I would like to know how they work together. an example I came across was the…
-
9
votes2
answers878
viewsHow to create a unique method to handle errors with ajax
I have a web application that performs several calls ajax. My college professor challenged me to create a generic message and combine the whole error treatment into a single function. Someone could…
-
9
votes3
answers197
viewsWhat is the function of this 'and' that is passed as a parameter?
The example I’m going to show you here is just to illustrate. I’d like to really understand how this one works e which is usually passed as a parameter in various functions that matches in codes…
-
9
votes6
answers2106
viewsSmooth gradient color transition automatically
Hello, I own a div with the following css: background: linear-gradient(to right, #3e42e4, #e53472); And I would like the colors to change through Javascript. Similar to the top of this site:…
-
9
votes3
answers2830
viewsExtract data from txt file to use in autocomplete
Update: Just for the record, there is no need to use jQuery-ui, it can be with another solution. I’m creating a autocomplete for a form, containing all the options in the CBO - Brazilian Code of…
-
9
votes2
answers1708
viewsIs it correct to concatenate PHP in Javascript?
I often use this method, but do not know if it is appropriate, to rescue the id in JS I use echo php <script type="text/javascript" src ="js/jquery.js"></ script> <script type…
-
9
votes3
answers260
viewsCreate a real "loading..."?
I’ve been researching some legal effects for a status of "Loading..." But I realized that on all the sites, they use timeout so that the animation goes in and out of the page, being then, just a…
-
9
votes5
answers20983
viewsGrab content from another page by javascript or jquery
I need to get content from another page inside the site using Javascript, I tried using ajax, but gives this error "Blocked cross-origin request: The same origin policy (Same Origin Policy) prevents…
-
9
votes3
answers7332
viewsHow to put scroll at the end of the div?
I have the following div <div style="height:300px;overflow-y:auto;"> ... </div> Inside it will have several texts and will make the scroll appear. When you refresh the page the scroll is…
-
9
votes1
answer508
viewsConvert date MMMM-YYYY to dd/mm/yyyy datepicker bootstrap
I have the following date field: <div class='input-group date input-data' id='datetimepicker4'> <input type='text' name="mes" id="mes" class="form-control hidden" /> <span…
-
9
votes2
answers4636
viewsWhat is the csrf_token present in the Laravel layout file for?
I am aware that to submit a form in Laravel, you must add a csrf_field, or declare that the route must ignore this protection. However, in the layout file there are the following occurrences:…
-
9
votes3
answers557
viewsSee if a video has been paused to upload?
I’m using the shaka-player to play a Dash stream from a Nimble server, but I’ve been reading that event waiting is not always the most reliable option, and in fact when the video stops to load the…
-
9
votes3
answers9259
viewsTime difference between two dates with Javascript?
Hello. I have these two dates: var dtPartida = "20170620 11:20"; var dtChegada = "20170620 16:40"; And I need to figure out the difference in time between those dates that in the case and 5 hours…
-
9
votes1
answer189
viewsWhy is the incrementer "lost" in the loop?
Making a simple loop FOR, I found a strange behavior that I couldn’t understand. The count is "lost" in the AJAX request, keeping the value of the incrementer with the last one. The request to the…
-
9
votes1
answer1350
viewsMove the character in the canvas and change image
Well, I would like to know how I could implement a Sprite on my canvas, I am very lay with canvas, the idea is, when pressing arrow -> he runs Sprite 1.png, when pressing arrow <- he runs…
-
9
votes4
answers199
viewsDifference between syntax to declare a function
Reading this answer, I realized different forms of call for a function using jQuery. The first way would be this: $('#dois').on("click", testar); function testar() { console.log('Teste Dois'); } And…