Linked Questions
23 questions linked to/from What does $(function() {} ); do?
1
vote
4
answers
3k
views
What does $(function() {}) mean in javascript [duplicate]
I am using the flot library for producing plots. The examples given on the website all have their javascript code written like this:
<script>
$(function() {
...
...
... plot ...
});
...
0
votes
1
answer
1k
views
jQuery global variable, not working [duplicate]
Why is this simple global variable not working inside a function
var test_1 = "None";
$(function(){
console.log(test_1)
})
I am getting the result Undefined
1
vote
3
answers
276
views
What does jQuery(function) or $(function) do? [duplicate]
Possible Duplicate:
What does $(function() {} ); do?
what exactly does the following syntax mean?
$(function() {..}
as in
$(function () {
$(".add_folder").click(function () {
Does it means ...
-6
votes
4
answers
160
views
what $(function () {...}); does in Jquery? [duplicate]
Saw this syntax in a code example:
<script>
$(function () {
function fun1(event) {
...
}
function fun2(event) {
...
}
});
</script>
Question is what the $(...
0
votes
1
answer
123
views
What does jQuery(function($) do and who does it belong to? [duplicate]
My Shopify store uses Ajax call's to add products to the cart and jQuery to update the front-end. I recently installed infinite-ajax-scroll but this brought some issues.
The store gets "ajaxified" by ...
0
votes
2
answers
96
views
How is this Javascript called? [duplicate]
I find the following code in an html document:
<script type="text/javascript">
$(function () {
...
});
I cannot see any intrinsic events like onload = and would like to know how ...
0
votes
0
answers
32
views
Wrapping or not within a function with JavaScript or jQuery [duplicate]
Not very fluent in JavaScript or jQuery for front-end dev. Let's say I have this code:
$("#foo").click(function (event) {
console.log("single click");
return false;
});
$(&...
0
votes
0
answers
26
views
How do you know when something is a Javascript function, and when its a jQuery function [duplicate]
I'm sorry if this is a stupid question, but I really don't know :(
Consider the code below:
function myTogglerFunc() {
$("h1").toggleClass("fave");
}
$(function () {
$("#...
0
votes
1
answer
3k
views
What "jQuery(function($) {" is for?
I'm pretty new to web programming.
Looking for a jQuery function I found something like:
jQuery(function($) {
$('#EleId1').click(function () {
//do stuff
}
$('#EleId2').click(...
0
votes
1
answer
2k
views
What is the best solution for scrollWidth problem?
In Chrome console:
$('.table-responsive').width(); //working
$('.table-responsive')[0].scrollWidth; //working
In code while rendering HTML:
$('.table-responsive').width(); //working
$('.table-...
2
votes
3
answers
801
views
Run Jquery function on page load once
I have the following Jquery function:
$( document ).ready(function() {
$(function() {
$('select[name="CPUmenu"]').change(function(e) {
let socket = $(this).val();
$...
-2
votes
4
answers
300
views
When to use $(function() {}) when registering click handlers with jQuery?
What is the difference between
$(function()
{
$(".some").click(function()
{
...
});
});
and
$(".some").click(function()
{
...
});
I know from here that $(function() is ...
0
votes
2
answers
330
views
jQuery code is not running with $(function(){...}); but will run without it
I'm very new to jQuery, but from what I've read, this doesn't make sense to me. Here is my code:
$(function() {
function grid() {
$("#main").hide();
}
});
<html>
...
0
votes
1
answer
457
views
HTML elements disappear when navigating to the page, re-appear on page refresh
Using Ruby on Rails for my framework.
I have written code to create a chessboard. My HTML elements that I have being created by JavaScript disappear when I first navigate to the page with the ...
0
votes
1
answer
203
views
Does a function inside jQuery constructor do anything different?
I feel like I've only ever seen this here on SO, but I can't seem to find any documentation on it. The code I am talking about is stuff like this:
$(function foo(){
alert('foo');
});
Is there ...