Unified way to change elements values
Hi guys,
My problem here is quite simple:
I have a wrapped set of elements, and I would like to change the value of each one of them.
Take a look here:
- init : function() {
- $('[data-role="page"]').live('pagebeforecreate', function(e) {
- var page = $(e.target);
- Localization.localize(page.find('[i18n]'));
- });
- },
- localize : function (page) {
- page.each(function(){
- elem = $(this);
- elem.val("My Test");
- });
Is there a unified way to change the value of an element without considering its type?
e.g.:
I can change the button element using val("new value"), but that won't work on other types, such as headers (the innerHTML value will stay the same)
Thanks in advance,
Alon