I try to make some new required fields with a error message! But i don't find how to do this! I use ctg-housing theme
This is the code in my file:
<div class="contact-us-your-name">
<label class="control-label" for="yourName">
<span class="required_fields">* </span>
<?php _e('Your Name', 'ctg_housing'); ?>
</label>
<?php ContactForm::your_name(); ?>
</div>
<div class="contact-us-your-email">
<label class="control-label" for="yourEmail">
<span class="required_fields">* </span>
<?php _e('Your E-mail', 'ctg_housing'); ?>
</label>
<?php ContactForm::your_email(); ?>
</div>
<div class="contact-us-subject">
<label class="control-label" for="subject">
<?php _e('Subject', 'ctg_housing'); ?>
(<?php _e('optional', 'ctg_housing'); ?>)
</label>
<?php ContactForm::the_subject(); ?>
</div>
<div class="contact-us-message">
<label class="control-label" for="message">
<span class="required_fields">* </span>
<?php _e('Message', 'ctg_housing'); ?>
</label>
<?php ContactForm::your_message(); ?>
</div>
<?php ctg_housing_show_flash_message(); ?>
<div class="contact-us-send-message">
<button type="submit" class="small radius text-center" style="margin-bottom: 0px;">
<?php _e("Send Message", 'ctg_housing');?>
</button>
</div>
Then i receive 1 error message see picture 1.
When i add the code for required i receive a wrong error see picture 2
<script type="text/javascript">
$("#message").attr('required', 'required');
</script>
And what i need is like the picture 3 that the error message appears under the field! See picture 3 like under email.
Thanks, hope someone can help.
You can try following javascript and place this to after form above footer hook function: