JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 13th, 2012, 07:38 AM
mbreezy mbreezy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2008
Posts: 110 mbreezy User rank is Sergeant (500 - 2000 Reputation Level)mbreezy User rank is Sergeant (500 - 2000 Reputation Level)mbreezy User rank is Sergeant (500 - 2000 Reputation Level)mbreezy User rank is Sergeant (500 - 2000 Reputation Level)mbreezy User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 21 h 58 m 49 sec
Reputation Power: 23
jQuery - JQ changing the text of a span

I'm having a problem with a little JQ. I had this working before and I think I tweaked something but now it's no longer functional. I just want to rule out it being my JS. Basically, when you hover over the span, it should show you some HTML from the data-team-score but it's no longer doing it.

Any help? I've looked it over and over. If the code below looks good then it must be the HTML inside the data tags.

Here's the HTML...
Code:
<span id="scr591236" data-my-score="some html in here" data-team-score="some html in here as well" class="social_stats">some text in here</span>
<span id="scr597405" data-my-score="some html in here" data-team-score="some html in here as well" class="social_stats">some text in here</span>



Here's the JS...
Code:
$("#scr591236, #scr597405").mouseover(function () {
		var $this = $(this);
		$this.fadeTo(500, 0, function() {
			$this
			  .hide()
			  .html($this.data("team-score"))
			  .show()
			  .fadeTo(500, 1); 
		});

Reply With Quote
  #2  
Old October 14th, 2012, 10:26 AM
leonvv leonvv is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2012
Posts: 24 leonvv User rank is Sergeant (500 - 2000 Reputation Level)leonvv User rank is Sergeant (500 - 2000 Reputation Level)leonvv User rank is Sergeant (500 - 2000 Reputation Level)leonvv User rank is Sergeant (500 - 2000 Reputation Level)leonvv User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 h 47 m 48 sec
Reputation Power: 0
I don't think this is correct: $("#scr591236, #scr597405")
You can't use a comma separated list of elements.

Anyway , I think this will help:
Code:

// Target all elements with a class of 'social_stats'
$(".social_stats").on('mouseover',function(){
$this = $(this);

// When hovered over, fade out in 500 milliseconds
$this.fadeOut(500,function(){
$this.html( $this.data("team-score") );
}).fadeIn(500);

});



Léon

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > jQuery - JQ changing the text of a span

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap