/    Sign up×
Community /Pin to ProfileBookmark

Validating data-thumb in XHTML 1.0 Transitional

Hi all,

I’m using a JavaScript powered slideshow that calls images as follows…

<div data-thumb=”images/thumbs/artistic-t.jpg”> <img src=”images/artistic-t.jpg “></div>

However, when trying to validate the code (XHTML 1.0 Transitional), it fails with the following error…

there is no attribute “data-thumb”

Is there any way around this?

Thanks

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@hyperionXSFeb 20.2012 — Yes, don't use data-thumb ?)

If this is mandatory, then remove data-thumb in HTML and insert them using JS
[code=html]
<div class="slideshow"> <img src="images/artistic-t.jpg "></div>
...

<script type="text/javascript">
$('.slideshow').each(function(){
$(this).attr('data-thumb', $('img', this).attr('src'))
})
</script>
[/code]

Make sure you call slideshow function AFTER this code.
×

Success!

Help @riz-man spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.15,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...