Tuesday, July 5, 2011

cfsavecontent vs CSS when wanting to add styles.

I ran into some confrontation when I decided to use a cfsavecontent and write some styles in <style/> tags and do a <cfhtmlhead/>. Another developer prefers everything in a .css file. While, yes all styles are in one place in the app, unneeded styles are being loaded on pages that don't need them.

I prefer the other route of doing styles in style tags on the page I am working in and then adding them to the head section. Don't get me wrong I still have some global styles set in .css files. Most of the pages I am working on are all custom interfaces and the .css file(s) would be unnecessary large between pages. Not to mention lots and/or large .css files bring down browser load time.

Thoughts?

Submit button name when posting form in JS

I am sure plenty of people out there have had this issue. So I had a submit button named "submit" and tried to do form submit in js by doing $("#theform").submit(); and I kept getting this error saying that .submit() wasn't a function. After some digging apparently if you name a submit button in a form "submit" it overwrites the submit() with submit button element. Not cool.