<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000066">
simple solution using your example that works
Create a js file "test.js" containing :
$('#freediv').html('<h1 id="test">test</h1>');
$("#test").click(function(){
alert("Bla");
});
I used an <a> tag in html to click to call the test.js file as
follows:
<script type="text/javascript">
$(document).ready(function() {
$('a').click(function(){
$.getScript("test.js");
});
});
</script>
</head>
<body>
<a href="#">Click Here</a>
<div id="freediv"></div>
</body>
</html>
Snef wrote:
<blockquote
id="mid_ec4ed8b5-6200-4176-abf0-bcd27024726b_q16g2000yqg_googlegroups_com"
cite="mid:
ec4ed8b5-6200-4176-abf0-bcd27024726b@q16g2000yqg.googlegroups.com"
type="cite">
<pre wrap="">The 'problem' using .live() is that i need to have all the scripts
loaded even when they are not used. I just wanted to have only the
scripts related to that form.
The check is either in 'view generated source' in FF and the dom
inspector.
I'm not sure about eval, sounds like evil ;)
A simple alert is executed, but can not be seen in the source (and i
think that;s why jQuery code doesn;t work).
Also tried it to use the $(document).ready, without success.
Jake schreef:
</pre>
<blockquote id="StationeryCiteGenerated_1" type="cite">
<pre wrap="">I'd suggest .live() still. Or maybe you could try eval() those
JavaScript code after Ajax fetch and DOM manipulation complete
manually? btw, do you check the page source using `view page source'
or firebug's dom inspector? latter recommended.