Oh, another method is to store the default values as a Javascript
array/object with a matching ID of the DIV. For example:
var defaults = {
'div1': 100,
'div2': 200
}
100
200
alert( defaults['div1'] ); // alerts '100'
On Oct 14, 8:29 am, Avik Basu wrote:
> Thanks for your help--using .text
You can store the original inside the element as an attribute.
There are several ways you can do this. Here are the popular methods:
One method is using the jQuery data() function:
http://docs.jquery.com/Core/data
However, this would require you to add the data via Javascript, which
maybe not wh
Thanks for your help--using .text() solved the scaling problem. A
related problem is how can I go back to the original values in the
divs when scaling multiple times? Right now the behavior is such that
it scales the div values properly the first time, but the second time
it scales the already s
parseFloat( $( this ).text() ) // divs don't have a value
On Oct 13, 4:07 pm, Avik Basu wrote:
> I would like to use JQuery to iterate through a set of elements
> that have the same class and scale each value according to a value
> selected from a dropdown box. For example,
>
>
> 1
> 2
> 3
>
If it's a div, val() will not get you anything. Use text().
$("#factor").change(function() {
var val = this.value; // value of select
$(".num").each(function() {
$(this).text( parseInt($(this).text()) * parseInt(val) );
});
});
On Oct 13, 10:07 am, Avik Basu wrote:
> I woul
5 matches
Mail list logo