Warning: The type attribute is unnecessary for JavaScript resources
-
Hey. Again. Thank you for an amazing form builder…
The HTML validation throws a single warning for the following code:
<script type="text/javascript" id="wsf-wp-footer">
Screenshot: https://snipboard.io/w9Lv4Z.jpg
One possible workaround is to add a filter that removes the unnecessary type attribute:
/* Snippet seeks to remove the warnings when validating HTML on w3c.org: */ /* Warning: The type attribute is unnecessary for JavaScript resources. */ add_action( 'template_redirect', function(){ ob_start( function( $buffer ){ $buffer = str_replace( array( ' type="text/javascript"', " type='text/javascript'" ), '', $buffer ); return $buffer; }); });
… that makes the site pass validation, but not including the type attribute in the first place, would be ideal.
Any recommendations?
Best regards
BjarneThe page I need help with: [log in to see the link]
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Warning: The type attribute is unnecessary for JavaScript resources’ is closed to new replies.