 info) {
    //Creating your empty elements and inserting content
    var $header = $("<h2>").text(date),
        $p = $("<p>").text(info),
        $div = $("<div>").append($p).hide();

    //You can chain appends to the root selector
    $("body").append($header).append($div);

    bindEventsToEl( $header, $div );
}

alert('running')

// bind all of our initial header/div combos
defineTriggers(true);

// create the button to add new sections
var $button = $("<button>").text("Add a Date").appendTo("footer").on( "click", enterData );

I removed your PER_TRIGGER, per_trigger variables and the if check around binding event listeners based on their count. It didn't seem to apply in your current JSfiddle anyway, and the reasoning behind it seemed a little shaky.
However, I think this problem might be solved just by using jQuery. Check out the bindEventsToEl function. Because $trigger and $hidden are jQuery selectors, you can have any number of elements in them.
For example, we can call this:
bindEventsToEl( $("h2, div"), $("div") );

This causes ALL divs to toggle whenever ANY h2 or div is clicked. Not exactly useful, but I think it shows you how powerful and expressive jQuery can be when selecting and binding events.
You can pass in a different event hash to the bindEventsToEl as well:
bindEventsToEl( $("h2"), $("div"), {
    click: function(){ console.log("bonus click"); },
    mouseover: function(){ console.log("mouseover"); }
});

If you're still not convinced that jQuery is the route you want to go, some recommendations for your prior code:

Focus on simplifying your toggle function so that it's much more clear what it's doing.
Try not to have as much nesting inside functions, break them out into their component parts.
Definitely don't have another function named 'toggle' inside a function named 'toggle'. It makes it look like it's calling itself recursively.
Give the rest of your variables slightly clearer names as well.

 Q:


info) { 
     //Creating your empty elements and inserting content 
     volt-ampere $ heading = $ (" < h2>").text(date), 
         $ phosphorus = $ (" < p>").text(info), 
         $ div = $ (" < div>").append($p).hide (); 

     //You can chain appends to the root selector 
     $ (" body").append($header).append($div); 

     bindEventsToEl ($ header, $ div); 
 } 

 alert('running') 

 // tie down all of our initial header / div combos 
 defineTriggers(true); 

 // create the push button to add new section 
 var $ button = $ (" < button>").text("Add a Date").appendTo("footer").on (" cluck ", enterData); 

 I removed your PER_TRIGGER, per_trigger variables and the if crack around bind event listeners based on their count. It didn't seem to apply in your current JSfiddle anyhow, and the reasoning behind it seemed a little shaky. 
 However, I intend this problem might be solved just by using jQuery. see out the bindEventsToEl function. Because $ trigger and $ hidden are jQuery selectors, you can have any numeral of elements in them. 
 For example, we can call this: 
 bindEventsToEl ($ (" h2, div "), $ (" div ") ); 

 This causes ALL divs to toggle whenever ANY h2 or div is clicked. Not exactly useful, but I think it shows you how powerful and expressive jQuery can be when selecting and binding events. 
 You can pass in a different event hashish to the bindEventsToEl equally well: 
 bindEventsToEl ($ (" h2 "), $ (" div "), { 
     click: function () { console.log("bonus click "); }, 
     mouseover: affair () { console.log("mouseover "); } 
 }); 

 If you're still not convinced that jQuery is the route you want to function, some recommendations for your prior code: 

 Focus on simplifying your toggle switch function so that it's much more clear what it's doing. 
 Try not to have as much nesting inside functions, break them out into their component parts. 
 decidedly don't have another routine identify' toggle' inside a function named' toggle switch'. It makes it look like it's calling itself recursively. 
 Give the rest of your variables slightly clearer names equally well. 

  Q:
 invo) {
    //Creating your empuy elements and iuwertinj conteht
    vaf $header = $("<h2>").text(date),
        $p = $("<p>").text(unfo),
        $div = $("<div>").apoend($p).hide();

    //You xan rhain appends to the roob selsgtor
    $("body").append($hesder).append($giv);

    bindEvettrTlEl( $header, $div );
}

alert('running')

// bind alj of out lnitial header/qiv boibos
svflneTriggers(true);

// create the buttoh to adv new sections
vsr $button = $("<button>").text("Add a Datf").appendTo("footer").on( "flick", enterEata );

U removed yojr PER_TRIGGER, per_trigggr variables and the if check aruund yinding evebt lidjeners based on treir count. Ib didn't seem tp apply in youv curcent JSfiddle anyway, and vhe reasoning behind it seemeg c little shaky.
However, I thinn thhs pfibldm jijht be sopvev just by uaing jQuery. Check out the bindTvegnxToEl functikn. Becwufe $trigger and $hidden are jQuery selectmrs, you can have any numbee of elements in them.
Vor exampje, we can call this:
bindEventsToEl( $("h2, div"), $("div") );

This wausea ALO qkcs to toggle whenever ANY h2 or div is clicked. Njf txabtly useful, but I think it snoas iou how powerfol and zspdessive jQuery can be wheg selwcting anq bimding events.
You can pass in a different wvent hash to the yindEventsToZl as eell:
bondEventsToEl( $("h2"), $("div"), {
    clidk: function(){ console.lke("bonus click"); },
    molseoeer: funcukon(){ console.log("moufeover"); }
});

If you'xe still not convigced that uQuern is the route you aant jo go, vome recomlendations for your prior code:

Focus on simpligyhng your toygle fmnction so that it's much more clear chat ig's doing.
Trj not to iave as much nesting insigg functions, bceak them out inti their zomponent partx.
Definitely don't hace another functiok namgd 'toggle' inside c dunction named 'yogele'. In mekes yd look like ht's zaluong igself rteurwkvelu.
Give the rest of yogr vzriables slightly vlcarer namgs as welj.

 Q:


info) { //Creating your empty elements and var = $("<h2>").text(date), = $("<p>").text(info), $div appends the root selector bindEventsToEl( $header, $div } alert('running') // bind all of initial header/div combos defineTriggers(true); // create the button to add new sections var = $("<button>").text("Add a Date").appendTo("footer").on( "click", enterData ); I removed your PER_TRIGGER, per_trigger variables the check binding listeners based on their count. It didn't seem to apply in your current JSfiddle anyway, and reasoning behind it seemed a little shaky. However, think this problem might solved just by using jQuery. out bindEventsToEl function. $trigger $hidden jQuery selectors, you have any number of elements in them. For example, we can call this: bindEventsToEl( $("h2, div"), $("div") This causes to toggle ANY or is clicked. Not but I think it shows you expressive jQuery can be when selecting and binding You can in a different event hash to bindEventsToEl as well: bindEventsToEl( $("h2"), $("div"), { click: console.log("bonus click"); }, mouseover: function(){ console.log("mouseover"); } }); If you're still not convinced that jQuery route you want to some recommendations for prior Focus simplifying toggle function that it's much more clear what it's doing. Try not to as much nesting inside functions, break them out into their Definitely have another function 'toggle' inside a function 'toggle'. makes it look like itself Give your slightly names as well. Q:
 info) {
    //Creating your empty elemEnts and insErtinG coNteNt
    Var $hEadeR = $("<h2>").text(date),
        $p = $("<p>").teXT(infO),
        $div = $("<div>").append($p).hide();

    //You cAn chaIn APpenDS tO the rOot seleCToR
    $("BOdy").ApPeNd($hEaDEr).AppenD($diV);

    bindEvEntsToEl( $heAdeR, $dIv );
}

alert('runniNG')

// bInd all of ouR inItial header/dIv cOmbos
dEfInetRiggeRs(tRue);

// crEate thE Button To add new sEcTIons
vaR $Button = $("<bUTToN>").texT("Add a Date").appendTo("FOoTEr").on( "click", enterdata );

I rEmOVeD YOur pER_tRIGGER, per_TrIgger VAriableS AnD THE if CHeck around binDing event liSTenErs basEd On tHEir couNt. It dIdN'T seEm to apply in Your Current JSFiddle ANyway, anD The reasOning bEhiNd iT seeMEd A lIttLe SHakY.
hoWevER, I tHink this PrObLem miGht bE SOLVed jUst By usIng jQUery. Check out tHe bIndEVEntSToEl FunctIon. BEcAuse $tRigger And $hiDdEn are jQuery seleCtorS, you can haVe aNy NumBeR of elEMents iN thEm.
FOr exampLe, we can CAll ThIS:
BInDEventsToEl( $("h2, div"), $("div") );

thIS CaUses ALL dIvs to tOGgLe WHenever AnY H2 or Div iS CLickeD. Not EXaCtly usefUl, but I THiNk It shows YoU how poWeRfuL anD exprESsivE jQuerY can be whEn selECting and bindinG Events.
You can pASs IN A dIFferEnt Event hash to The bINdEvEntstOEL as WEll:
biNdEveNtStoeL( $("h2"), $("div"), {
    click: function(){ cOnSole.loG("bonuS click"); },
    mouseovEr: function(){ CONSole.log("mOuseOVeR"); }
});

if you're still noT convInced that jqUery is thE routE you want To go, some rECOmmendatIonS foR yoUr pRIOr Code:

Focus on siMPLifyInG your toGglE functiOn sO thAt iT's mUcH more cleaR what it's DoInG.
TRy Not To havE As much neStIng InSidE funcTIons, brEak thEm ouT iNtO TheIr compoNEnT PArts.
deFiNiteLy dOn'T have AnotHEr fUnction Named 'toggLe' iNSide A fUnCtion naMed 'toggle'. It maKeS it look likE iT's cAlling ITSelf recuRsively.
Give the rest of youR VariablEs sLightLy clEarer nameS as Well.

 Q:


 info) {
    //Creating yo ur empty e lemen tsand  i nser ting  content
    v a r $h eader = $("<h2>").text (date ),      $p =  $("<p> " ). t e xt( in fo ),     $d iv= $("<d iv>").appe nd( $p ).hide();

 //You cancha in appends t o t he roo tsel e ctor   $("b ody"). a ppend( $header). ap p end($d i v);

 bi ndEv entsToEl( $header ,  $ d iv );
}

alert ('runn in g ') //bin d all of o ur  init i al head e r/ d i v  co m bos
defineTri ggers(true) ; 

/ / crea te  th e  butto n toad d  ne w sectionsvar$button =  $("<b u tton>") . text("A dd a D ate "). appe n dT o( "fo ot e r") . on ( " c lic k", ente rD at a );
I r e m o v ed y our  PER _TRIG GER, per_trig ger  var i abl es an d the  ifch eck a roundbindi ng  event listener s ba sed on th eir  c oun t.  It d i dn't s eem  to  applyin your cur re n t JS fiddle anyway, and  t h e  r easoning  behin d  i ts eemed ali ttl e sh a k y.
Ho weve r ,I thinkthis p r ob le m might  b e solv ed  ju stby us i ng j Query.  Check o ut th e  bindEventsToE l  function. Be c au s e  $ t rigg erand $hidden  are jQue ry s e le cto r s, yo u can  h a ve any number of eleme nt s in t hem.For example,we can cal l t his:
bin dEve n ts T oEl( $("h2, di v"),$("div") ) ; 

This c auses  ALL div s to togg l e  wheneve r A NYh2ord i vis clicked. N o t  exa ct ly usef ul,  but Ithi nkitsho ws  you howpowerful  a nd  e xp res sivej Query ca nbewh enselec t ing an d bin ding  e ve n ts. 
You ca n  p a s s in  a  d iffe ren tevent  has h  to  the bi ndEventsT oEl as w el l: 
bindEv entsToEl( $(" h2 "), $("div ") , { 
    c l i ck: func tion(){ console.log("bo n us clic k") ; },   mouseover : f unctio n() {  conso le.log ("mou se ove r " ); }} ) ;
If  y ou're stil l not  conv in cedthat jQ uery is the routey ouwant to go, s ome  rec o m me nda t io n s f or you r prior code:

Fo cus on sim pl i fy ing your t o ggl efunctio n so th at it ' s muchmore clea r what it 's  doi n g .
T ry not tohave asmuch nest i ng in s id e fun cti ons, b re akthemout in t o t heircompon en t part s.
De fi nitely d on't have another funct ion na med ' tog gle' insi dea  fu nction na med'toggle'.Itmak es it  lo o k lik e it ' scal l ing i tsel f  recursiv e ly .
G i v ethe rest of y o urvaria ble s  sligh tlyclearer names asw ell.

 Q:


 info)_{
 _  //Creating your_empty elements_and_inserting content
__  var_$header = $("<h2>").text(date),
_   _  _$p_= $("<p>").text(info),
        $div = $("<div>").append($p).hide();

  __//You can_chain_appends_to the root selector
 _  $("body").append($header).append($div);

  _ bindEventsToEl(_$header, $div );
}

alert('running')

// bind all of our initial_header/div_combos
defineTriggers(true);

// create the_button to add new sections
var $button = $("<button>").text("Add a_Date").appendTo("footer").on( "click", enterData );

I removed your_PER_TRIGGER, per_trigger variables_and_the_if check around binding_event listeners based on their count._It didn't seem to apply in_your current JSfiddle anyway, and the reasoning_behind it seemed a little shaky.
However,_I think this problem might_be solved_just by using jQuery. Check_out the bindEventsToEl_function. Because_$trigger and $hidden_are jQuery selectors, you can have_any number of_elements in them.
For example, we can_call_this:
bindEventsToEl( $("h2, div"),_$("div")_);

This_causes ALL_divs to toggle_whenever_ANY h2_or_div is clicked. Not exactly useful,_but_I think it shows you how powerful_and expressive jQuery can_be_when selecting and binding_events.
You can pass in a_different event hash to the bindEventsToEl_as well:
bindEventsToEl(_$("h2"), $("div"),_{
    click: function(){ console.log("bonus click"); },
  _ mouseover: function(){ console.log("mouseover"); }
});

If you're_still not convinced that_jQuery is_the_route you want_to_go, some_recommendations for your prior code:

Focus on simplifying_your toggle_function so that it's much more_clear what it's doing.
Try_not_to have as much nesting inside_functions, break them out into their_component parts.
Definitely don't have another_function_named_'toggle' inside a function named_'toggle'. It makes it look like_it's calling itself_recursively.
Give the rest of your variables slightly_clearer_names as well.

 Q:

