The dialog section of JQ.Zemplate will focus on the discussion of jQuery topics that may address certain issues with coding, better approaches for coding, clever applications of jQuery, and so forth.
Below is a list of articles that you may find enlightening or may help you with a specific problem that you have had with your own jQuery project.
Use JSON to find the IP address of the visitor
When developing or maintaining a website there may be some features that only you want to see. An example could be a small box in the top right corner that tells you the screen width, which can be very useful when developing a responsive website. You may also want to block a person from a specific IP address from viewing your site.
There is a simple line of JSON code that you can add to a .js file that your site uses. This code will retrieve the IP Address of the user.
jQuery callback functions
If you have a situation with your jQuery script where you do not want something to happen until something else is finished, you can employ a callback function.
How and why to use console.log(); rather than alert(); for debugging.
alert("Hello, I got to here");
The alert(); in your code at specific locations allows you to see if a specific function is being called or if the code is progressing past a certain point. You may also may want to see if the variable is receiving the right information with something like this:
alert("callInfoBox: " + callInfoBox);
Local Variables vs Global Variables
Variables are containers that hold a value. You use variables for many different things throughout your script. You may need them for values that change throughout the script or you may just need them for a short term.
If your code has come to a dead stop, the first thing to look at are mistakes with the punctuation.
Is it better to have your own jQuery files or use a remote source?
When you want to use jQuery on your web site, you must allow the browser to access the jQuery core file. Depending on what all you are using as far as jQuery, you may also need the files for jQuery UI functions and or jQuery UI style sheets.
The question is whether it is best to download these file to your own hosting server and link to these locally sourced files or whether to link to external sites such as Google's Hosted Libraries. There are pros and cons to each way of linking to these jQuery files.
In this article we will discuss the PROS and CONS of linking to your locally sourced jQuery files or linking to an external source.