How to insert Javascript into an inline form edit via an extension?
cj(function ($) {}) has an implicit document.ready. To unpack that dense few characters of code:


cj is the deprecated alias of CiviCRM's copy of jQuery. In 4.5 and above use the new one: CRM.$.
Passing a function straight into jQuery is an alias of calling jQuery(document).ready() (not one that we made up, it's a jQuery thing).
The argument your function receives ($) is yet another alias of jQuery, which you should use inside your code block to make it more readable (so your code inside should be $('.crm-button-type-upload... not cj(...).
So the whole thing, written out in full would be CRM.$(document).ready(function($) {$('.crm-button-type-upload').hide();}); (not that I'm saying you can't use the shorter form CRM.$(function($)... I just wanted to make it clear what's going on)


To answer your question about how to include your js. As of 4.5, CRM_Core_Resources will add javascript files to snippets, and by default it does. I just tested it out and was able to get a script file loaded when I clicked to open an inline edit form on the contact summary page.

The only time this wouldn't work is if you specify the "header" region as the location for your script. This is because ajax snippets do not have a header.

You can find out more about loading javascript files and ajax at: http://wiki.civicrm.org/confluence/display/CRMDOC/Resource+Reference