This is the same as https://www.drupal.org/project/drupal/issues/1664602
> ## Problem/Motivation
> Currently there is no way to pass `#attributes` to the `drupal_add_js()` function. This is not a feature that is widely used, however, there are unique cases where the `` tag generated needs to have available an `id=""` or other unique attributes to that tag.
>
> ## Proposed resolution
> By initializing the `#attributes` key of the `$js_element` array we can easily pass specific `#attribute` elements in our `drupal_add_js()` calls, and since `theme('html_tag', array('element' => $js_element));` handles `#attributes` passed to it, all additional support is inherited. Here is an example of the new attribute code working in the case 'external' type of `drupal_add_js()` is invoked. The patch of course accounts for all cases of `'type'`:
```php
case 'external':
$js_element = $element;
// Attach custom attributes to the element.
$js_element['#attributes'] = !empty($item['attributes']) ? $item['attributes'] : array();
// Preprocessing for external JavaScript files is ignored.
if ($item['defer']) {
$js_element['#attributes']['defer'] = 'defer';
}
$js_element['#attributes']['src'] = $item['data'];
$processed[$index++] = theme('html_tag', array('element' => $js_element));
break;
```
Recent comments
The horrors of cut/paste! Brilliant, thanks.
SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect string value:
The issue could be related to the Emojis in the body field. Can you check the Status report (admin/reports/status) for the item MySQL Database 4-byte UTF-8 support? To display Emojis, 4-byte UTF...
SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect string value:
@argiepiano, thanks a lot! For Webform it will be always "webform_client_form_NID", correct?
How to add Webform ID to Captcha module?