javascript - Setting text for external HTML file -


i trying set text div located in external html file, when give id of div, not recognized, should do? load external html file this:

$('#header').load("resources/html/header.html"); 

then try set "headertitle" inside header.html

$('#headertitle').text($('#buidlingcombobox :selected').text());   

if give id inside main html file, works fine.

you have wait until content available, , load() has handy callback :

$('#header').load("resources/html/header.html", function() {     $('#headertitle').text( $('#buidlingcombobox').val() );   }); 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -