• I’m trying to add a javascript function, just to toss up an alert – say “hello world,” as a plugin that will get inserted into the admin_head.
    The problem is, every time I will get an error for trying to modify <head> after it’s been created.
    Naturally, I could just go in and edit in my function into admin-header.php. But what fun would that be?
    Any thoughts?
    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • There’s no need to add JavaScript into the head tag. Unlike CSS, the script tag can be used nearly anywhere and not violate any rules.

    Thread Starter unoamigo

    (@unoamigo)

    Interesting, it doesn’t work or run that way.
    A script tag can be, however a JavaScript function needs to be placed into the head tag. Unless your going to tie it directly into an action such as onclick. Something I’m not doing. 😉

    Thread Starter unoamigo

    (@unoamigo)

    Guess I’ll have to play with it more. Haven’t had time in the last couple days, thanks for the input though. Has anyone actually done something like this?
    Try to write a plugin that simply pops up an alert when a new post is made or edited. That’s the general idea, I’m doing screening of the title name first. Which is easy, it’s getting that stupid javascript to run.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘JavaScript added to admin_head from Plugin’ is closed to new replies.