Forums

How to get element of the page in a hidden input

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 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.