Reputation: 3518
I found this HowTo and modified the script a bit, but I would like to select id tags rather than class tags. In other words: Right now it works for class="title", and I like it to work with id="title"
<script type="text/javascript" language="javascript">
$(function() {
var language = '{{@LANGUAGE}}';
$.ajax({
url: 'vps.xml',
success: function(xml) {
$(xml).find('translation').each(function(){
var id = $(this).attr('id');
var text = $(this).find(language).text();
$("." + id).html(text);
$("." + id).addClass(id + '_' + language);
});
}
});
});
</script>
Upvotes: 0
Views: 77