Create hidden field jQuery

Hi Guys!

Im trying to create a hidden form field in a parent window from within a child window (popup). I am trying to use jQuery, but unfortunately the hidden field does not get created. Does anyone have an idea what could be wrong?


function save_industries() {
    var namelist = [];
    with(document.select_industries) {
        for(var i = 0; i < industry.length; i++) {
            if(industry[i].checked) {
				namelist.push(industry[i].value);
				$('#opener.document.searchform').append('<input type="hidden" name="industry[]" value="' + industry[i].value + '">');
            }
        }
    }
    if(!namelist.length) {
        alert('Please select at least 1 industry.');
    } else {
        opener.document.getElementById('industry_list').innerHTML = "<span class=\\"info\\"><a href=\\"#\\" onclick=\\"java_script:select_industries('" + namelist + "')\\">Industries selected, click to edit</a></span>";
		window.close();
    }
}

Are you sure

$('#opener.document.searchform')

is selecting the form in the parent window like you want? It just looks off to me, like you copied the way you address that element in the native JS DOM into a jQuery selector?

About the only success that’s commonly found when doing that is for the parent window to have a function that does what you need, and to call from the child window that parent function.