I have this jquery code inside my wordpress admin page that checks if the input value is empty.
$j(function(){
$j('form').submit(function(){
var link = $j('#input').val();
if(link == ''){
alert('hi there');
}
});
});
Now if the form is empty it will alert ' hi there'.
the plugin works fine but the alert does not show on the main page. Only in the admin section.
what would be the problem?
here is how I am calling jquery.
function test(){
wp_enqueue_script('jquery');
wp_enqueue_script('myscript', plugin_dir_url(__FILE__). 'js/test.js');
}
add_action('wp_enqueue_scripts','test');
add_action('admin_head','test');
I would like that if the value of input is empty, the alert show also in the wordpress homepage and not only in the admin page.