Search code examples
jqueryprototypejs

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?


Solution

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

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

    or

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

    for classes. just like css.