If you look at the reference link, it has an iframe that accesses its parent reference for jquery. Is this same thing possible if, instead of an iframe, it was a child window?
P.S.
Despite the unknown reason for syntax error the click handler still works if I continue through the error?
syntax error
I'm getting a non-descriptive syntax error on return window.opener.$
when it's called by $('#Button1').
So, I'm not getting to my alert.
parent window
<html>
<body>
<input id="Parent_Button1" type="button" value="Pop out window" />
<script>
window.onload = function () {
$('#Parent_Button1').on('click', function () {
window.open('pop-out-win.aspx', '', 'width=400,height=300');
});
}
</script>
</body>
</html>
child window
<input id="Button1" type="button" value="push me" />
<script>
window.onload = function () {
if (typeof (jQuery) == "undefined") {
var iframeBody = document.getElementsByTagName("body")[0];
var jQuery = function (selector) { return window.opener.$(selector, iframeBody); };
var $ = jQuery;
var btn1 = $('#Button1');
btn1.on('click', function () {
alert('achievement unlocked!')
});
}
}
</script>