Is this valid jQuery? Or have I mixed it up with regular JavaScript too much? In any case it is not working (I would expect it to print “testing” between the appropriate tags):
<script type="text/javascript">
var testing = "testing";
testIt=function() {
$('#cont').html(testing);
}
</script>
to be invoked when:
<input TYPE="button" NAME="button4" Value="Write" onClick="testIt()">
obviously there is a:
<div id="cont"> </div>
in the html.
No, that’s not “mixing jQuery and Javascript” too much. jQuery is Javascript. You won’t ever have to worry about mixing them.
I can’t reproduce your problem. Your code seems to be working fine. See it in this demo.
That said, I think you should use a method that is more idiomatic to jQuery instead of mixing Javascript with the markup.
I would recommend changing the
NAMEattributeto an
idattribute:and using this jQuery: