Forums

Can't change content of div with jquery

marklandry 05 Sep, 2013
Hi,
I'm trying to change the content of a div based on text input. I've got the text input part working, ie, I can fire an alert box when the number in the text box isn't high enough, but I can't get the div I'm targeting to change.

Here's my code:

window.addEvent('domready', function() {
   $('part_1_age').addEvent('blur', addBlock);
});

function addBlock() {
   if($('part_1_age').value<18) {
        //alert('jeeze');
        $('undereighteen').html('<h2>New info</h2>');  
   }
}


Not sure what I'm doing wrong, this works outside of CF... Am I missing something?
GreyHead 05 Sep, 2013
Hi Mark,

This is MooTools (not jQuery) the syntax is in the MooTools docs. Please try
$('undereighteen').set('html', '<h2>New info</h2>');


Bob
This topic is locked and no more replies can be posted.