Replace string with variable of the same name

时间:2016-06-06 14:16:49

标签: javascript jquery

Outside of a tooltipTemplate: "<%= label %>: <%= value %>%", loop, I have: $.each()

Inside of a var $address = xyz loop, I have: $.each()

Inside this var $string = "_address" loop, I need to replace $.each() with $string, but it's on a $address loop, so I need to do the same with $.each(), $state, etc.

The code:

$zip

Is being modeled from what I did earlier here:

$("input.changed.address, select.changed.address").each(function(){
    var edit_id = $(this).attr('id');
    var main_id = edit_id.substr(5);
    main_id_same_variable_name = (serialized_changes.filter(function (field) { 
        return field.name == edit_id 
    })[0]['value']);
});

But I don't have the luxury of using a div ID like I did directly above ^^, I need to change a global variable in the first code snippet.

0 个答案:

没有答案