jQuery can only clone what is on the current page or what is loaded over AJAX, so setting something up on the backend and cloning it on the front is not possible. What you can do is create a string and print to the front as a Javascript variable or as a hidden div that you can then clone with jQuery. WordPress does this on the backend if you look near the top of any backend page. For example:
function tst() {
echo '<script type="text/javascript">var hello="hi";</script>';
}
add_action('wp_head','tst');
Related Posts:
- getting the values of hidden inputs to use them in a php mysql query
- Remove specific javascript when viewing page in Customizer?
- Input field duplicates on form submit by jQuery
- Styling a specific post after hovering over it
- How to echo a PHP code into WooCommerce variation product?
- How can i get the same ajax result using WP REST API instead of admin-ajax?
- How to call a function from functions.php with ajax?
- Custom theme admin-ajax.php 400 (Bad Request)
- Remove item from post_meta array via AJAX
- WordPress load javascript file if something… (after the page is loaded)
- include javascript Multiple files in wordpress through script.js
- Let user select the number of posts shown per page jquery error
- number of posts with “Load More”
- How to call WordPress PHP file using external js file
- PHP array to jQuery array ” Uncaught SyntaxError: Unexpected token < "
- Creating Log-In Page for backend server
- defined (‘ABSPATH’) false after AJAX post to other PHP-file
- Bootstrap Carousel Indicators Won’t Cycle On Custom WordPress Theme
- Is there a reason why my wordpress PHP page isn’t loading into my PHP template
- ACF + WP + Slick Slider Repeater Slide Group PHP not Displaying [closed]
- I was wondering if it’s possible to implement card.js on WordPress
- Find the method which AJAX GET calls
- AJAX Filter WHILE Loop not working WordPress
- Default Image not showing up in Customizer for WP_Customize_Cropped_Image_Control
- Calling header from JavaScript file
- How to create a radio button to alt between settings in wp_options table
- Ajax not updating to database
- WordPress 404 when using AJAX to call php function
- wordpress ajax pagination
- WordPress AJAX load post metadata in modal
- how use php query in AJAX jquery
- jQuery doesn’t work in my php snippet
- Using Custom Javascript and pHp to send email to myself when a user clicks on an input button but only works on Chrome, IE, and Micorosft Edge
- Ajax Load more CPT via shortcode
- Form not working as it should in WordPress, but in a normal HTML site it does
- Why I’m Not Having Access to “$_POST” Data Outside My AJAX Callback?
- Add a downloaded JS file to WordPress
- Submitting my form to the database and then redirecting to payment site
- WordPress Setting API – There is no field in options.php
- Slider from different widgets
- Querying posts based off a jquery datepicker
- AJAX Not Working With WordPress Database properly
- How to call javascript function (jquery) in a shortcode?
- Extend the WP_Customize_Image_Control class to change its non-frame $button_labels
- A Customizer checkbox control that sets the setting to “” or to “blank” and show() or hide() a color control
- Pass the updated value of aid from form using ajax
- ajax form with multiple submit buttons and values
- How to run ajax in WordPress Post?
- 500 (Internal Server Error) of external php file
- Adding unique marketing messages between certain products whilst using isotope/Infinite Scroll
- Pass php to database in JQuery: With AJAX?
- Use jQuery and AJAX to get HTML
- How can I correctly POST to a WordPress page?
- No Authors for custom post type
- Adding instant search to wordpress page
- Fatal error: Call to a member function get_results() on a non-object in on line 26
- Add php function into .js file (for tinyMCE button)
- Undefined index notice when using the $args parameter in add_settings_field()
- Why this plugin is not working?
- Combining fancybox with multiple thumbnail plugin
- Dynamic Gallery
- Trying to fix multiple category drop down
- What is the best way to get the first few post from WordPress in different divs using a loop?
- Missing items on page
- Adding javascript files to WordPress and jQuery version
- I am trying to call external database recieving error
- Highlight posts currently being edited on multiple editor site?
- How to change links in the 3 main categories, on widget category, to a javascript function call
- jQuery vs. $ – Creating jQuery scripts in JavaScript in WordPress using External Libraries
- reorder a WP_Query, using a dropdown
- best way to communicate between php and jquery/javascript
- Loading a post’s content, into a div outside the loop, when it’s title is selected in a list
- Cannot get custom javascript to execute on page
- Fatal error: Uncaught Error: Call to undefined function wp_nav_menu()
- Edit Image/Image Details – Replace button missing
- ajax form function error
- Add specific phrase after every product title including the discounted price? [closed]
- why my “recepie” category is not taken into account in my request
- AJAX: WordPress filters inside $html do not work as intended
- Adding Custom JQuery Menu Fresh Slide Out
- Why not showing all post by default in my jquery filter
- ACF repeater image in video poster with jquery
- Load Meta box value into div AJAX [duplicate]
- Jquery autosave text area after typing
- Pass a PHP variable (loop-audio.php) to jQuery function (js/script.js)
- Use ajax response in PHP function
- JSON Object Value Show Undefine
- Adding jquery using php function
- How to hide .js files on wordpress website using php or wp plugins or any? [closed]
- Different behaviour between “include_once” and directly echoing out html code?
- notify users when changed database
- How to use js variable to php in wordpress functions.php
- Replace the image of a product with its video in the shop page
- getJSON response to PHP
- ajax problems on loading page [closed]
- generate excerpt from the part of big text dump that contains keyword
- Upload multiple files via ajax from an HTML file input
- get_post_meta returns on side but it doesn’t return on bottom of admin page
- Help with AJAX request
- how to test for options(fields) in settings API?