i am trying to add keyup function in wordpress so email address is directly populated from blog admin and when users type/edit the email address the corresponding link gets updated accordingly.
Here is my code
<input name="pluginemail" type="text" id="pluginemail" value="'.get_bloginfo('admin_email').' " onchange="kpoejy.updateSignupEmail();"> <a type="button" id="request_key" class="button button-primary" title="Request a new API key" href="http://somesitess.com/g11.php?pluginemail='.get_bloginfo('admin_email').'" onmouseenter="kpoejy.updateSignupEmail();" target="_blank">Request Key</a>
here is javascript in external file named javascr.js
var kpoejy= function() {
function updateSignupEmail() {
jQuery('#request_key').attr('href', jQuery('#request_key').attr('href').split('?')[0] + '?pluginemail=' + jQuery('#pluginemail').val());
}}
this is included using
wp_register_script( 'javas-js', plugins_url( '/js/dist/javascr.misc.js', __FILE__ ), array( 'jquery' ) );
i tried wp_localize_script
, wp_enqueue_script
also but getting always same error
Uncaught ReferenceError: kpoejy is not defined
any idea where i am doing mistake. its for wordpress 4.8