I was driven by this problem to crazy, I am working on an asp.net web project, so I use facebox to make a page popup, the popup page is only a confirmation, users need to click confirm button, then I need to delete an option from a select which has been used jquery chosen.js to translate.
On the main page, the select
<select>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
On the popup page, I call a js method
var acqlistSelect = $("#selectId", window.parent.document);
var acqlistSelectIndex = acqlistSelect.prop("selectedIndex");
$("#selectId option", window.parent.document).eq(acqlistSelectIndex).remove();
acqlistSelect.chosen({disable_search: true}).change();
acqlistSelect.trigger("liszt:updated");
And you know the chosen selected li has not been deleted. But if I call the similar method on the main page itself, like
var acqlistSelectIndex = $("#selectId").prop("selectedIndex");
$('#selectId option').eq(acqlistSelectIndex).remove();
$('#selectId').chosen().change();
$("#selectId").trigger("liszt:updated");
It works perfectly, the chosen select li has been removed. Any idea. really appreciate it.
OK,I have figured out how to do that, I added some breakpoint on the chosen event liszt:updated, and i found out when I run the code
Actually it didn’t hit the breakpoint, but the js method on the main page did it, so I call
from the popup page, and it did hit it. good. Done