hi guys!!

i want to add some checkbox on a div container dinamically; i do it on
another part of my page and it works. Now i want to do the same on
another side but the append method doesn't work. It just add on the
container string text but not the checkboxs.

This is the function that i'm use to do that:

containerToFill is the div container that i want to append all the
checkbox dinamically

function createSearchObjects (operationType, containerToFill,
searchText)
{
    var newCheckBoxPrefix, searchCheckBoxPrefix, c,
valueOfMatchCheckBox;

    if (operationType == 'A'){
        newCheckBoxPrefix = "AddCheck";
        searchCheckBoxPrefix = "#Acheck";
    }
    else{
        newCheckBoxPrefix = "EditCheck";
        searchCheckBoxPrefix = "#ECheckbox";
    }

    containerToFill.append("<div><p>Search Results</p></div>");
    containerToFill.append("<div>");
    for (i = 0, c = 0; i < num_application; i++)
    {
        valueOfMatchCheckBox = $(searchCheckBoxPrefix + i).val();
        //test if the application at position i contains the search
text
        if( valueOfMatchCheckBox.toLowerCase().match
(searchText.toLowerCase()) != null)
        {
            if (c > 0)  containerToFill.append ("<br/>");

     <b>This is the append that doesn't work and i don't know why!!!!!!
</b>
            containertoFill.append("<input type='checkbox' name='" +
newCheckBoxPrefix + "' id='" + newCheckBoxPrefix + c + "' value='" +
valueOfMatchCheckBox + "' >");

     <b>instead this text is append on the div container.</b>
            containerToFill.append("<b>" + valueOfMatchCheckBox + "</
b>");

            c++;
        }
    }

    <b>This is the same of above and it works, the only difference is
that here i don't use parameters</b>
    containerToFill.append("<input type='checkbox' name='AddCheck'
id='AddCheck0' value='XXX - test' >");

    num_applicationSearch = c;
    containerToFill.append("</div>");
    $('#contentApplicationList').fadeOut(450);
    containerToFill.fadeIn(450);
}

thanks for answers!!

ds

Reply via email to