You can hook into the DOMNodeInserted
event to find out when your widget has been added to the side bar.
jQuery(document).on('DOMNodeInserted', '.widget-top', function () {
alert(jQuery('.widget-title', this).text());
});
The code above will alert to any newly added widget. Once you’re hooked into the newly created widget, you can traverse it to find your specific class and take action, if it is your widget that was added.
Tested only with Firefox.
You can find out more information with this jQuery question https://stackoverflow.com/questions/15268661/jquery-on-create-event-for-dynamically-created-elements
Related Posts:
- Enabling jquery when dragging available widget to sidebar area
- How do I rebind event after widget save
- How to listen to color changes on the color picker?
- Ban certain widgets from certain sidebars
- Widget “Save” resetting jQuery hidden fields
- jQuery does not work in widget backend
- Trigger Submit Event when Widget is added to Sidebar
- How to enable “shift-click to edit this widget” functionality on a custom widget?
- cannot drag and drop widgets since wordpress 3.2.1
- AJAX Contact Form Issue
- jQuery UI inside widget on admin page
- WP_enqueue_script() loads them always in wp_footer()?
- Wrap the widget content with a div and get the widget title outside? [closed]
- Access Customizer widget instance form
- How i can widget ID get after drag for wordpress with jquery?
- wordpress widget missing jquery
- Making jQuery .change() event persistent after widget save
- Jquery checkbox -show posts with checked tags
- Using AJAX in WordPress Widget
- Custom tabs widget don’t work in google chrome, is blocked, do not change the tabs. Why?
- Multiple widgets in wordpress
- jQuery “on” handler does not fire on newly inserted widgets [closed]
- Using AJAX in a Widget to Sort items [closed]
- Programmatically add widgets to sidebars
- changing wp-admin/widgets.php
- Get Widget Instance inside Widget
- Add the sidebar/widget editor to the post edit screen?
- WP_Widget deprecated error in WordPress V4.3
- Remove before_widget / after_widget content from Wp_Widget_Text
- Is dynamic forms/entries possible in Widget?
- Help adding image upload functionality to widget
- Big side banners
- Display specific widgets in different area’s around the page
- Need help adding additional controls to a custom widget Part 2
- How to add the widgets manually to the sidebar?
- How to check if widget has automatic title
- Using Ajax call in jQuery doesn’t work in widget
- Unable to save widget contents
- Use wp_enqueue_style based on user option in widget
- When you register a sidebar in WordPress, is it possible to choose in what order it appears in the admin
- dynamic_sidebar() returns false in admin section
- Moving comments section to left of content (Twenty Thirteen)
- Custom Tag Cloud widget missing tags
- How to get sidebar’s content inside admin-ajax?
- Full width layout for custom post type pages
- wp_count_posts, wp_count_terms and wp_count_comments for specific user?
- Why does WordPress stores widget options in a multidimensional array?
- Run JS after widget settings are saved?
- Shortcode displays always first. Once again
- Can I create drag and drop widgets like iGoogle in WordPress?
- Display the id list of active widgets of same sidebar?
- How to remove a widget from the sidebar on specific page?
- When adding a widget, what kind of widget should I used to add images and text and styling?
- Where do I save widget code for wordpress?
- Is there any way to print a widget by having its id?
- Create a widget to use shortcode?
- Need help using a filter on the default Categories widget
- Print owned created widget
- widget dropdown menu code
- isSavingPost() for widgets
- Content of widgets keep disappearing over and over again
- custom widget does not saved value
- Add visual editor style only on widgets.php page
- Widget Select Options not saving
- Edit and make class-wc-widget-featured-products.php update-proof
- Display Widgets Horizontally in Area [closed]
- I have a widget area in my header. How can I have that display a different widget depending on what group is shown?
- change widget to display excerpt instead of content
- How do widgets access posts they should display?
- Remove links from meta widget
- How to make home widgets appear horizontally
- Multiple rows of footer widget areas
- How do I make the title of the following widget editable?
- Escape HTML on WP input
- how can i display all youtube videos from a users youtube account
- Link a widget or find the php that creates the widgets
- Issue with checked() echoing on to page
- Problem with WP_Query loop and search term
- Set a dashboard widget to the top?
- How to decorate WP_Widget_Text?
- After adding widget the style is messing up
- Siderbar implementation with collapsible bootstrap cards
- Simple SCript Not Displayed in WIdth
- Where to add a widget class?
- Does current page contain widget or sidebar
- Active Sidebar Conditional Question?
- Paginate recent posts widget
- Widget front-end fails to echo as expected from checkbox
- Adding Widgets to Reactor Theme (based on Foundation 4)
- Help me tidy up my widget code
- Neaten content — different widget or CSS change?
- Custom widget breaking widget section in admin menu
- Unique widget id in sidebar
- Taxonomies not showing in WP Dashboard Right Now widget
- trying to Change to wp_register_sidebar_widget
- How to delete Jetpack Widgets from the Widgets page in admin panel [closed]
- How can I order the “Woocommerce Products Widget” by the sales date? [closed]
- Widget does not work with WooCommerce enabled
- How can I add a toggle element into an image box element? [closed]
- Can’t edit the widgets sidebar or footer