TeraTech

The ColdFusion Experts: Develop | Secure | Optimize

  • Services
  • About
  • CF Alive
  • Blog
  • Podcast
  • Contact

  • Services
  • About
  • CF Alive
  • Blog
  • Podcast
  • Contact

18 Amazing JQuery tips (that will supercharge Web 2.0 apps)

September 17, 2009 By Michaela Light 1 Comment

Here are 18 amazing JQuery tips that Jo Ann shared after CFUnited this year. Enjoy!

PS What are your JQuery tips?

  1. Syntax:  The dollar sign ($) is an alias for the jQuery object.
  2. Best documentation (online reference) is:   http://docs.jquery.com/   [www.visualjquery.com, which I have used, is only up to version 1.2.6 (and the current release is 1.3.2)]
  3. OK to call the $(document).ready() function as many times as you want on the same page.  They will execute in turn; they don't overwrite each other.  This is in direct contrast to the more traditional body onload attribute, where it is NOT OK to use more that one definition. If you add 2 definitions for body onload, the 2nd overwrites the first, and the first is never executed.
  4. In JavaScript, the Function IS a datatype.  This is very important in jQuery, because many jQuery methods take functions as parameters.
  5. Named functions:  doSomething(param1, param2) { [some action statements in here]; }  If I set myVar1 = doSomething(“foo”,”bar”); then myVar1 contains the RESULT of doing something with “foo” and “bar”.  But if I set myVar2 = doSomething;     (i.e., without the parens) now myVar2 IS the same function as doSomething.  Now myVar2(“foo”,”bar”); will return the same thing as doSomething(“foo”,”bar”);  This concept can be useful if you need to pass functions to a method that takes one or more Functions as arguments.
  6. An Anonymous Function in JavaScript is a Function declaration without a name.  For example, $(document).ready() takes as an argument a Function that receives the ready event as an argument.  Typically instead of declaring a named function and putting the name inside the ready() parens, you put ready(function(event){ [what to do goes in here]; })
  7. Can use jQuery to intercept a button click or other event, do some validation or manipulation with information on the page, and submit a hidden form instead of ever giving the user direct access to the form inputs.  Also for CFFORM augmentation – for example to grab the error messages and log them, to do some analysis before submission, to visually magnify the field with incorrect input so the user can see it better to verify.
  8. Can overload existing JavaScript functions.  For example, overloading alert() could make the standard CF-generated validation messages display in a nicer alternative appearance and style.
  9. Syntax: .attr(‘[attribute_name]') is a getter, and .attr(‘[attribute_name],'[value]”) is a setter.
  10. Syntax: the filter  :eq(3)  gets the 3rd element of a set, while  :nth(3)  gets EVERY 3rd (i.e., 3, 6, 9, 12 …)
  11. A filter such as  :last  is applied to the selected / returned SET of elements – so ‘li:last'  gets the last <li> element on the page, NOT the last item in EACH list on the page.
  12. Syntax: A space in a selector (example ‘#list2 li:last') means get all of the 2nd selector that are descendants of the element(s) returned by the first selector (as opposed to separating with > which signifies “direct children” instead).
  13. Utilities are jQuery methods without selectors [examples:     $.each()   or   $.support()   ]
  14. How people create compressed and obfuscated JaveScript files: jsmin utility to strip out extraneous white space, yuicompressor to obfuscate by replacing variable names with something less easy to understand.  (However, JS is always still out in the world for everyone to see!)
  15. jQuery UI is the only jQuery plugin created by jQuery itself.  Use Theme Roller: http://jqueryui.com/themeroller/  to create custom UI themes (try out and style the various UI elements).
  16. http://layout.jquery-dev.net  – look at Layout Inside Dialog
  17. Syntax tip: parseInt('30px') takes the 30 out of '30px'
  18. Can use jQuery along with CF-generated JavaScript validation, for instance to enable/disable/re-enable CF validation in response to a browser-side event of some kind.

Related Posts

  • 092 How to start and run a CFUG (experts panel) with Daniel Garcia, Leon O'Daniel, Michaela Light and Nolan Erck092 How to start and run a CFUG (experts panel) with Daniel Garcia, Leon O'Daniel, Michaela Light and Nolan Erck
  • State of the CF Union Survey 2016 (Amazing Results Part I)State of the CF Union Survey 2016 (Amazing Results Part I)
  • November's MDCFUG LunchNovember's MDCFUG Lunch
  • 050 Improve your CFML Code Quality (with some Cool Tools) with Kai Koenig – Transcript050 Improve your CFML Code Quality (with some Cool Tools) with Kai Koenig – Transcript
  • ColdFusion Expert's Guide to Different Skills for Getting Things Done
  • Georgetown ColdFusion project praiseGeorgetown ColdFusion project praise
  • Facebook
  • Twitter
  • LinkedIn

Filed Under: JavaScript, Tips, Web 2.0

← Previous Post Congratulations Liz!
Next Post → Great CIOs mix business and tech skills

CF Alive Best Practices Checklist

 

Modern ColdFusion development best practices that reduce stress, inefficiency, project lifecycle costs while simultaneously increasing project velocity and innovation.

Recent Posts

  • 4 Reasons Why Your ColdFusion Web Apps Are Suffering (And How To Avoid It)
  • Google Down – An Unprecedented Event (Save Your Data Fast!)
  • 107 ColdFusion 2021 Revealing Details on How it was Created with Rakshith Naresh
  • Into The Box LatAm 2020 Virtual Conference – Free to Register!
  • Slow ColdFusion Applications May Ruin Your Business (3 Steps to Prevent It)

Categories

  • ActionScript
  • Adobe CF Summit
  • Adobe CF Summit East
  • Adobe CF Summit East 2018
  • Adobe ColdFusion 11
  • Adobe ColdFusion 2020 Beta
  • Adobe ColdFusion 2021
  • Adobe ColdFusion Project Stratus
  • Adobe ColdFusion Security
  • AIR
  • Ajax
  • AngularJS
  • Announcement
  • API
  • Apollo
  • Auto Security Lockdown
  • AWS
  • C#
  • Certification
  • CF Alive
  • CF Alive Book
  • CF Alive Podcast
  • CF Camp
  • CF Developer week
  • CF Maintenance
  • CF Summit India
  • CF Tags
  • CF Training
  • CF Vs. Other Languages
  • CFEclipse
  • CFML
  • CFML Open- Source
  • CFObjective
  • cfquery
  • CFSummit
  • CFUnited
  • China Chopper
  • CIO
  • Classes
  • Client Highlights
  • ColdBox
  • ColdFusion
  • ColdFusion 2018
  • ColdFusion 2020
  • ColdFusion 2021
  • ColdFusion 9
  • ColdFusion community
  • ColdFusion Conference
  • ColdFusion Consulting
  • ColdFusion Developer
  • ColdFusion Development
  • ColdFusion Hosting
  • ColdFusion Security
  • ColdFusion Webinar
  • CommandBox
  • Conference
  • Cool Stuff
  • Culture
  • Cybercrime
  • Database
  • Development Approach
  • DevOps
  • Docker
  • Fixinator
  • Flex
  • Frameworks
  • Fusebox
  • FusionReactor
  • Futurology
  • Garbage Collector
  • Google Down
  • Into The Box Latam
  • IntoTheBox Conference
  • Java
  • JavaScript
  • JVM
  • Learn ColdFusion
  • Legacy Code
  • Load Testing
  • Lucee
  • Management
  • MAX
  • MDCFUG Lunch
  • Microsoft Azure
  • Mindmapping
  • MockBox
  • Modernize ColdFusion
  • Monitoring
  • Muracon
  • NCDevCon
  • New Intern
  • News
  • Node.js
  • Open- Source
  • ORM
  • Ortus Developer Week
  • Ortus Roadshow
  • Performance
  • Performance Tuning
  • PHP
  • Productivity
  • Programming Languages
  • Project planning
  • Query of Queries
  • Roadmap
  • Scalability
  • Security
  • Server Software
  • Server Tuning
  • Social Media
  • Spiral Web
  • SQL
  • Success Story
  • Survey
  • Technology
  • TestBox
  • Tips
  • Transcript
  • Trapeze Development
  • Uncategorized
  • Web 2.0
  • Web Application
  • Web Server
  • Webinar
  • Webmail
  • What is ColdFusion?
  • Whole Brain Development
  • Women in Tech
  • Work From Home

Recent Comments

  • Michaela Light on A Comprehensive Guide to Running a Successful CFML Project
  • Michaela Light on Is Lucee CFML now better than Adobe ColdFusion?
  • Michaela Light on Introducing Swansea Jack (Lucee CFML 6 announced)
  • Michaela Light on 082 ColdFusion and the Blockchain Revolution with Mike Brunt
  • Michaela Light on 082 ColdFusion and the Blockchain Revolution with Mike Brunt
  • Home
  • Services
  • About Us
  • CF Alive
    • CF Alive Book
    • CF Alive Inner Circle
    • CF Alive full resources cheatsheet
  • Blog
  • Podcast
    • Podcast Guest schedule
  • Contact
  • Sitemap

The ColdFusion Experts:
Develop, Secure, Optimize

TeraTech Inc
451 Hungerford Drive Suite 119
Rockville, MD 20850

Tel : +1 (301) 424 3903
Fax: +1 (301) 762 8185

Follow us on Facebook Follow us on LinkedIn Follow us on Twitter Follow us on Pinterest Follow us on YouTube

Copyright © 1998–2021 TeraTech Inc. All rights Reserved.