I have
$('#hidden-data').find('#' + $(this).attr('id')).html(currdata);
var hiddata = $('#hidden-data').find('#' + $(this).attr('id')).html();
I want to translate this to javascript but my brain is melted. Please help ;p
I have
$('#hidden-data').find('#' + $(this).attr('id')).html(currdata);
var hiddata = $('#hidden-data').find('#' + $(this).attr('id')).html();
I want to translate this to javascript but my brain is melted. Please help ;p
The simplest version, given that IDs should be unique:
var hiddata = this.innerHTML = currdata;
The shortened jQuery version accounting for ID uniqueness makes this a bit more apparent:
$(this).html(currdata);
var hiddata = $(this).html();
Since you're taking the id
attribute from this
and no other element should have that ID, just use this
, no need to find anything else in the DOM...you should already have the element.
var o = document.getElementById(thisid);
o.innerHTML = currdata;
var hiddata = o.innerHTML;