While working on a new project for $WORK, I had the opportunity to use the FullCalendar.js library, which is a very good attempt at re-creating Google Calendar for us mere mortals.
One of the tasks I wanted to accomplish was to append an object property to the event.title, but not actually change that event title (E.g., event.title = "Test Title", event.custom_property = "tylerdurden1". Title should read "Test Title (tylerdurden1)".).
To accomplish this:
Full initialization:
My musings while programming in a number of languages and libraries, from PHP, Perl, JavaScript, jQuery, and KnockoutJS, with liberal use of CSS and Bootstrap to make it all pretty.
2015-06-03
2015-02-27
jQuery: Counting the number of matching class elements on the page
While working on a project I hacked some code together to count the number of flagged questions in an exam. My initial code, which is bad and poorly optimized as seen here:
While here I have my optimized code:
Not only is the optimized code smaller (nearly half as many lines and its also much easier to read.
Labels:
JavaScript,
jQuery
Location:
Milwaukee, WI, USA
2015-01-08
jQuery: Hot Keys!
A while ago we added a button on one of our pages that takes you to the next logical place on the page. This button over time has moved and is far from the inputs it needs to take you to. The next logical enhancement for this button was to make it a hot key as well, so that is what I've done.
In addition to jQuery, which is already loaded on our pages we've added a small-ish (4.52KB, 1.95KB minified) library called, jquery.hotkeys.js. With a couple of lines I was able to add in a simple hot key combo that also takes you to the same logical spot on the page. This allows our users to keep their hands on the keyboard for better efficiency.
Example:
In addition to jQuery, which is already loaded on our pages we've added a small-ish (4.52KB, 1.95KB minified) library called, jquery.hotkeys.js. With a couple of lines I was able to add in a simple hot key combo that also takes you to the same logical spot on the page. This allows our users to keep their hands on the keyboard for better efficiency.
Example:
Labels:
JavaScript,
jQuery
Location:
Milwaukee, WI, USA
2015-01-06
jQuery: Finding the first input with a class
Just a quick little snippet for finding the first input on the page with a specific class.
Labels:
JavaScript,
jQuery
Location:
Milwaukee, WI, USA
Subscribe to:
Posts (Atom)