I have a Javascript code on a popup window. Now I need to use it without pop up. It means in a page which consists of iframe.
Inside the Iframe, there is a page with the form name "ChatMsg" and text field name "mesg".
So I need to place onclick script on the main page, it should pass value into iframe page.
I added an ID for the iframe, iframe id is btnLocFrame
Current code in the top page are first two code parts given below, form is in third part of the code (source page of the iframe).
I tried to correct the code by changing window.opener into window.top but it doesn't work
<a href="javascript:pick(':IG');" alt=":IG" title=":IG"><img class="img-responsive" src="https://www.onlanka.com/chat/converts/smile7.gif"></a>
<script language="javascript">
function pick(symbol) {
if(window.opener) window.opener.document.chatMsg.mesg.value += (window.opener.document.chatMsg.mesg.value == "") ? symbol : " " + symbol;
}
</script>
<form name="chatMsg">
<input type="text" name="mesg" id="mesg" maxlength="512" value="" autocomplete="Off">
</form>
I had expected to pass assigned value of the link into form text field after click on the link but it doesn't work.
Please help me to correct the code