jquery - read a div from an html file to a javascript var -


i want read coltwo div file members.html (in same folder) variable, set innerhtml variable. result 'undefined'. how can fix this?

var fredpagevar;  $.get("members.html", function(data){      fredpagevar = $(data).find('#coltwo').html();  }); function fredpage(){     document.getelementbyid('boldstuff').innerhtml = fredpagevar;} 

based on markup : <li><a href="#" onclick='fredpage()'>fred</a></li>

try -

function fredpage(){    $.get("members.html", function(data){      $('#boldstuff').html($(data).find('#coltwo').html());    });  } 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -