senzacionale
senzacionale

Reputation: 20916

prototype into jquery migration problem

i try to migrate prototype to jquery. i start with

if (visible) {
        $(name + "_area").setStyle1({ display: 'block' });
    }
    else {
        $(name + "_area").setStyle1({ display: 'none' });   
    }

and i chnage to

function SetAreaVisibility(visible, name) {
if (visible) {
    $(#' + name + '_area').css('display', 'block'); 
}
else {
    $(#' + name + '_area').css('display', 'none'); 
}

which not working like i thing. is this correct code?

Upvotes: 1

Views: 98

Answers (1)

Andy
Andy

Reputation: 30135

what is name+"area" ? if it's an id you'll have to write:

$('#'+name+'_area')

or

$('.'+name+'_area')

for classes. just like css.

Upvotes: 2

Related Questions