How to get element of the page in a hidden input

How to populate a hidden input with page element content in ChronoForms.

Overview

The issue occurs when custom JavaScript code placed in the setup tab fails to execute because the DOM is not fully ready.
Place the JavaScript code within a JavaScript element in the designer's Custom section and enable the 'dom ready' setting to ensure it runs after the page loads.

Answered
ChronoForms v6
ju juansolos 19 Sep, 2017
Hi,
i try to insert element of the page in an input (not page title or anything else be catching by shortcode)

In the page (above the form), i have
<div id="myid">mycontent</div>

In the form, i have a input with id text1.
How can i put the content of the div in the input on page loading?

I create a custom code in the setup tab onload with
<script type="text/javascript">
jQuery('#text1').val( jQuery('#myid').html() );
</script>


No effect.
What is the right method, please?

Regards

ps sorry wrong tag (not chronoconnectivity 6 but chronoform6)
Max_admin Max_admin 20 Sep, 2017
Answer
Hi Juan,

You need to place the code below inside a "JavaScript" element (under designer > Custom) and enable the "dom ready" setting:
jQuery('#text1').val( jQuery('#myid').html() );


Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.