jQuery and General JavaScript Snippets

This will be a growing list of jQury, maybe even general JavaScript Snippets that I use a lot and always forget. # Add/Remove a class jQuery Add a class to a element jQuery(‘selector’).addClass(‘active’); Remove class from an element $( “p” ).removeClass( “myClass yourClass” ) # Find the html <a> Element with href that contain a …


JavaScript – Getting URL Parameter and setting a URL parameter (Snippet)

# Getting a URL Parameter A function that you give it the param, (url params or url args, whatever you want to call it) to find from the current url (key), and she returns the value of that parameter. var getUrlParameter = function getUrlParameter(sParam) { var sPageURL = decodeURIComponent(window.location.search.substring(1)), sURLVariables = sPageURL.split(‘&’), sParameterName, i; …


JavaScript – On document ready (Snippet)

# JavaScript – On document ready (Snippet) Common use is let’s say you want to change color to an element to red, but when you run it you get a console error telling you that the element doesn’t exist, depending on your code structure, it is possible that this code is running before that …


Bootstrap Responsive Debugging – CSS Media Queries Debugging

Easy way to debug Responsive media breakpoints when you are using Bootstrap. If you are not using Bootstrap you can still adapt this method for Bootstrap debugging in your project, all you need to do is just write these classes to fit your grid system and breakpoints and you are good to go. Just …