Title: Throws Error When Embedding Code
Last modified: February 26, 2021

---

# Throws Error When Embedding Code

 *  Resolved [Stef](https://wordpress.org/support/users/serafinnyc/)
 * (@serafinnyc)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/throws-error-when-embedding-code/)
 * Messes with drop down toggle menus in mobile devices. Other devs added snippet
   to searchform.php in Avada theme and then added that to Child theme. Menu on 
   mobile device stops working on that theme and a few others I tested.
 * The code they used was as follows
 *     ```
       <form role="search" class="searchform" method="get" action="<?php echo esc_url_raw( home_url( '/' ) ); ?>">
       	<div class="search-table">
       		<div class="search-field">
       			<input type="date" value="Y-mm-dd" name="s" class="s" placeholder="<?php esc_html_e( 'YYYY-MM-DD', 'Avada' ); ?>" required aria-required="true" aria-label="<?php esc_html_e( 'YYYY-MM-DD', 'Avada' ); ?>"/>
       		</div>
       		<div class="search-button">
       			<input type="submit" class="searchsubmit" style="font-size:16px"><i value="" />
       		</div>
       	</div>
       </form>
       ```
   
 * This unfortunately breaks everything. Need to hook it in from functions
    -  This topic was modified 5 years, 2 months ago by [Stef](https://wordpress.org/support/users/serafinnyc/).
    -  This topic was modified 5 years, 2 months ago by [Stef](https://wordpress.org/support/users/serafinnyc/).

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [joelparker](https://wordpress.org/support/users/joelparker/)
 * (@joelparker)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/throws-error-when-embedding-code/#post-14107885)
 * [@serafinnyc](https://wordpress.org/support/users/serafinnyc/) Please share a
   link to page where you are facing this issue or provide screenshot of console,
   is there any error on console related to this plugin?
 * thank
 *  [joelparker](https://wordpress.org/support/users/joelparker/)
 * (@joelparker)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/throws-error-when-embedding-code/#post-14107980)
 * [@serafinnyc](https://wordpress.org/support/users/serafinnyc/) Please also share
   screenshot of **searchform.php** how you are using the provided code snippet 
   in **searchform.php**.
 * In your code snippet I have noticed that you are using input type date, this 
   is not valid type for datepicker. If you want to use date field from WP Datepicker
   plugin you should use input type text and use id or class of that filed in WP
   Datepicker settings page.
 * Thanks
 *  Thread Starter [Stef](https://wordpress.org/support/users/serafinnyc/)
 * (@serafinnyc)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/throws-error-when-embedding-code/#post-14107991)
 * That is the searchform.php up top [@joelparker](https://wordpress.org/support/users/joelparker/)
 * > Other devs added snippet to searchform.php in Avada theme
 * I already fixed it on my own. Wanted to point out a problem for junior devs so
   that they don’t make this mistake.
 * P.S. doesn’t matter if it’s not the standard. The prev devs set it that way and
   in troubleshooting changing the input to anything didn’t work either. Just FYI.
    -  This reply was modified 5 years, 2 months ago by [Stef](https://wordpress.org/support/users/serafinnyc/).
 *  Plugin Author [Fahad Mahmood](https://wordpress.org/support/users/fahadmahmood/)
 * (@fahadmahmood)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/throws-error-when-embedding-code/#post-14114714)
 * [@serafinnyc](https://wordpress.org/support/users/serafinnyc/) thank you so much
   for creating this thread so new developers can understand this conflict. Actually
   modern browsers are overriding the datepicker functionality by sniffing all input
   type date fields.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Throws Error When Embedding Code’ is closed to new replies.

 * ![](https://ps.w.org/wp-datepicker/assets/icon-256x256.gif?rev=2286804)
 * [WP Datepicker](https://wordpress.org/plugins/wp-datepicker/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-datepicker/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-datepicker/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-datepicker/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-datepicker/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-datepicker/reviews/)

 * 4 replies
 * 3 participants
 * Last reply from: [Fahad Mahmood](https://wordpress.org/support/users/fahadmahmood/)
 * Last activity: [5 years, 2 months ago](https://wordpress.org/support/topic/throws-error-when-embedding-code/#post-14114714)
 * Status: resolved