Panel javascript problem within fields

Today I tried to add a javascript file to a field the correct way. The problem is that my javascript does not do what I expect.

Javascript

$(window).load(function(){
	$("div").html("hello world");
	console.log('hello');
});

The console says “hello”. Great, the javascript is loaded correctly. I also expect all the divs in my text to say “hello world”. Nothing happens.

I even tried to run this on window load instead of document ready. Nothing works.

A workaround

I can just say that is my way of trying to get around the limitation of that there is not a way to include javascript into the panel. No luck so far.

Update: To test the code

I based the code on this:

If you want to help, download it and just replace all javascript in the js file with my example code above to try it out.