Avoid using the universal selector (*) as your CSS reset selector at all costs. Taking the lazy way out and using (*) to reset your CSS will increase your page load time.
Tag Archives: tip
How to comment in JavaScript
Using comments in code can be useful for a variety of reasons. Maybe you work in a team or you are creating a reusable script. Regardless of your development needs, comments are a great way to make your code maintainable.
Comments in JavaScript can be done in two ways:
Single Line JavaScript Comment
To comment a single line of JavaScript you begin the comment with two forward slashes “//”. For example:
// declare a variable for color var color = "red";
Multiple Line JavaScript Comment
To comment multiple lines you begin the comment with “/*” and end with */. For example:
/* a multi line comment to say that my favorite color is not red it is blue */ var color = "blue";
How to Determine if an Element Exists with jQuery?
jQuery makes it easy to determine if an element in your DOM exists.
if ( $('#elementID').length )
{
// do something
}
Simple enough, right?