Body: <p>I have a custom plugin that uses a custom field leveraging the <code>elementSelect</code> fieldtype to select an asset (which is then processed on submission via a custom service). However, when I select an asset via my field, I get the following JS error in console:</p>
  
  <pre><code>Uncaught Error: Syntax error, unrecognized expression: [data-id="["1286"]"]:first
  </code></pre>
  
  <p>The integer above relates to the selected asset.</p>
  
  <p>Has anyone come across this issue before?
  It was working previously so not sure if a Craft update has broken it. </p>
  
  <p>The plugin field template:</p>
  
  <pre><code>{% import "_includes/forms" as forms %}
  {{ forms.elementSelectField({
          elementType: elementType,
          sourceElementId: value,
          value: value,
          elements: elements,
          sources: volumes,
          label: 'Your asset',
          limit: 1,
          id: name,
          name: name })
  }}
  </code></pre>
  
  <p>Cole</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-09-28T20:39:13.677Z
Comments.Text: Could you please explain the variables you used? The `value` property for example isn't needed, what value have your `elementType` and `elements` variables?
Comments.UserDisplayName: Robin Schambach
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-10-02T13:53:42.743Z
Comments.Text: Thanks for the reply Robin. The `elementType` is set to 'craft\elements\Asset' and the elements is an array containing a previously saved element (so null if new entry or not specified)
Comments.UserDisplayName: Cole Henley
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-10-05T18:44:04.810Z
Comments.Text: My guess would be that one of your parameters is incorrectly set. Without seeing their values it is tough to troubleshoot this further.
Comments.UserDisplayName: Ben Croker
Tags: <plugin-development><assets><craft3><custom-fieldtype>
Title: Custom plugin: asset fieldtype
ThreadText: # Custom plugin: asset fieldtype
  
  (Asked by: username_0 on 2018-09-28)
  
  I have a custom plugin that uses a custom field leveraging the `elementSelect` fieldtype to select an asset (which is then processed on submission via a custom service). However, when I select an asset via my field, I get the following JS error in console:
  
  ```
  Uncaught Error: Syntax error, unrecognized expression: [data-id="["1286"]"]:first
  
  ```
  
  The integer above relates to the selected asset.
  
  Has anyone come across this issue before?
  It was working previously so not sure if a Craft update has broken it.
  
  The plugin field template:
  
  ```
  {% import "_includes/forms" as forms %}
  {{ forms.elementSelectField({
          elementType: elementType,
          sourceElementId: value,
          value: value,
          elements: elements,
          sources: volumes,
          label: 'Your asset',
          limit: 1,
          id: name,
          name: name })
  }}
  
  ```
  
  username_0
  
  **Tags:** plugin-development, assets, craft3, custom-fieldtype
  
  > **Comments:**
  > **username_1**: Could you please explain the variables you used? The `value` property for example isn't needed, what value have your `elementType` and `elements` variables?  
  > **username_0**: Thanks for the reply username_1. The `elementType` is set to 'craft\elements\Asset' and the elements is an array containing a previously saved element (so null if new entry or not specified)  
  > **username_2**: My guess would be that one of your parameters is incorrectly set. Without seeing their values it is tough to troubleshoot this further.  
  
  ---
  
  ## 0 answers
  
  