Using string and variable input while using load

Using string and variable input while using load

Hi i am trying to create a dynamic <div> using append and then load an external html file into it.

  1. var refId = "Id1";
  2. $('#divContainer').append("<div id='"+refId+"'></div>");
  3. $("'#"+refId+"'").load("RE/"+refId+".html");

i have a file RE/Id1.html.

The div gets created but the load statement does not work.