The following jQuery example should put some text into the div, but it doesn't. I tried Firefox, Google Chrome and Internet Explorer.
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" language="javascript"></script>
<script language="javascript">
$(window).load(function() {
$('adiv').html('<p>hello world</p>');
alert('done');
});
</script>
</head>
<body>
<div id="adiv">
</div>
</body>
</html>
Sorry, this might be stupid, but I'm stuck.
change $('adiv').html('<p>hello world</p>');
to
$('#adiv').html('<p>hello world</p>');
You're not actually selecting anything in your select function
Directly after your $(
opening, you need to use a CSS3 valid selector. Just a string won't select anything unless it's a HTML element (table
, div
, h2
)
You need to preface it with a .
or a #
to signal either a class or ID name.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With