admin管理员组

文章数量:1391818

Since I cannot search for this with meaningful results, I can't be sure that this is not a duplicate.

However, I am running a JSSOR Slider on my site and some of the elements have a u property for example:

<div  u="slides" style="cursor: move;
position: absolute; left: 0px; top: 0px; width:
1300px; height: 500px; overflow: hidden;">

This "u=slides" is throwing up an error when I run it through a W3 Validator, however when I remove this property from the element, the slider no longer functions.

I am wondering the purpose of this property as I see no markup for it anywhere, and wondering if it can be substituted for anything in order to make the site pass markup validation.

Thanks in advance.

Since I cannot search for this with meaningful results, I can't be sure that this is not a duplicate.

However, I am running a JSSOR Slider on my site and some of the elements have a u property for example:

<div  u="slides" style="cursor: move;
position: absolute; left: 0px; top: 0px; width:
1300px; height: 500px; overflow: hidden;">

This "u=slides" is throwing up an error when I run it through a W3 Validator, however when I remove this property from the element, the slider no longer functions.

I am wondering the purpose of this property as I see no markup for it anywhere, and wondering if it can be substituted for anything in order to make the site pass markup validation.

Thanks in advance.

Share Improve this question edited Aug 19, 2014 at 11:56 James Donnelly 129k35 gold badges215 silver badges223 bronze badges asked Aug 19, 2014 at 11:45 Richard GrandiRichard Grandi 472 silver badges7 bronze badges 3
  • 1 Maybe it's used somewhere in javascript? – u_mulder Commented Aug 19, 2014 at 11:47
  • ok what is your issue? – cracker Commented Aug 19, 2014 at 11:47
  • 2 use a slider plugin that doesn't rely on invalid custom attributes. – Bergi Commented Aug 19, 2014 at 11:47
Add a ment  | 

1 Answer 1

Reset to default 8

Custom attributes (in HTML5) can be assigned to elements using the data-* prefix:

<elem data-u="slides"></elem>

The problem here, however, is that whoever developed this JSSOR Slider plugin has decided not to use valid HTML5 markup. Unless the plugin's JavaScript code is modified to look for a data-* attribute rather than an invalid attribute named "u", you will not be able to modify this attribute without breaking the way your site functions.


Update: Digging deeper I've discovered that this was already raised as an issue on JSSOR's GitHub repository back in January: https://github./jssor/jquery-slider/issues/4. They've rectified this by allowing you to use a valid data-u attribute instead of u.

The Solution

Provided your JSSOR plugin code is up to date. You can simply modify your HTML to:

<div data-u="slides" style="...">

本文标签: javascriptquotuquot property within an elementStack Overflow