WordPress.org

Ready to get started?Download WordPress

Forums

replace .copy-paste with on page load? (1 post)

  1. deepbevel
    Member
    Posted 3 years ago #

    I was wondering if anyone might know how to change this code so the copy-paste function is changed to a function that just pastes when the page loads, without the click?

    In functions.php

    function imath_copy_paste(){
    		{	?>
    		<script type="text/javascript">
    			jQuery('.copy-paste').click(function(){
    				var shortcode = jQuery(this).find(":first").val();
    				jQuery("#content-text-ta").val(jQuery("#content-text-ta").val()+shortcode);
    			});
    		</script>

    In a custom page template:

    <div class="copy-paste">
    	<input type="hidden" id="copy-paste-shortcode" value="[xilipostinpost query='name=<?php echo $post->post_name;?>']&nbsp;"	<a href="javascript:void(0)" title="click here to add this contnent to the entry form on the right.">add this entry to my trip!</a>
    </div>

    I don't really know Java, hoping it's a simple adjustment.

    thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.