Reply Thread Tools Search this Thread
Old 18-08-2010, 19:04   #1 (permalink)
Mild Fuzz
Korma Kameleon
 
Mild Fuzz's Avatar
 
Join Date: Feb 2008
Posts: 849
attaching a variable to a DOM element: jQuery

how can I attach a variable to a DOM element, in jQuery, on the fly

something like

Code:
$('.event h2').currentWidth = $('.event h2').css('width');

so that I can keep my vars with their relevant DOM elements
__________________
  Reply With Quote
Old 18-08-2010, 19:20   #2 (permalink)
smoseley
 
Posts: n/a
You could add a non-w3 attribute:

$('.event h2').attr('currentWidth', $('.event h2').css('width'));
  Reply With Quote
Old 18-08-2010, 20:31   #3 (permalink)
delatorre
Vegetating
 
delatorre's Avatar
 
Join Date: Oct 2008
Location: Pais del Scorchio
Posts: 172
I'm a MooTools user, but just googled 'jquery equivalent of store' and found the data() method - Use jQuery's data() method to store data in the DOM

Not sure if that's what you're looking for.
  Reply With Quote
Old 18-08-2010, 20:46   #4 (permalink)
Mild Fuzz
Korma Kameleon
 
Mild Fuzz's Avatar
 
Join Date: Feb 2008
Posts: 849
Excellent, cheers.
__________________
  Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive
vBulletin © 2000-2009 Jelsoft Enterprises Limited.
Search Engine Optimization by vBSEO 3.0.0 RC8