Skip to main content
12 events
when toggle format what by license comment
Dec 29, 2012 at 16:19 vote accept Travis Pflanz
May 2, 2012 at 15:45 comment added EAMann It's not grabbing the closing /div. It's creating a new, empty <div> element. <div /> is shorthand for <div></div>. There is no selector id to grab since the element doesn't exist. $('<div />') or $('<div></div>') both create a new element and automatically select it. Then you can assign an id, class, content, etc and append it to the page. See here for documentation on it ...
May 2, 2012 at 15:41 comment added Wyck True, it just seems odd to me, to grab the closing /div instead of the selector id which would most likely be faster.
May 2, 2012 at 13:37 comment added EAMann @Wyck There's absolutely nothing wrong with his JS. He's using jQuery to dynamically build new elements and append them to the page. It works just fine.
May 2, 2012 at 13:36 history edited EAMann CC BY-SA 3.0
Add explanation of how to integrate.
May 2, 2012 at 5:18 comment added Wyck You JavaScript looks really weird, I'm sure that won't work, try using EAMann's example and the console in firebug or chrome, or jsfiddle.net.
May 2, 2012 at 2:59 comment added Travis Pflanz updated question
May 2, 2012 at 2:51 comment added EAMann I'd need to see what's in your alert.js file and exactly how you're registering the file with WordPress. Please edit your question to include those details.
May 1, 2012 at 22:36 comment added Travis Pflanz I suppose I am asking how to add this to the alerts.js file I already have. I have pasted it as you've written, but nothing happens. I even tried to delete everything else from the file, only leaving your code, still nothing showed up.
May 1, 2012 at 22:21 comment added EAMann If you already have a JS file you enqueue on the admin side, use that. If not, you'll need to create one and use admin_enqueue_scripts to add it on the admin side.
May 1, 2012 at 21:41 comment added Travis Pflanz Thanks. How do I go about implementing this? I already have an alerts.js file that I use for adding notes to tags, categories and featured image meta boxes. I figure this would be a good place to include it. This is the method I used to create it - wordpress.stackexchange.com/questions/49014/…
May 1, 2012 at 20:12 history answered EAMann CC BY-SA 3.0