jquery

Close All Other Opened Modals when Opening a New Modal

Add data-dismiss="modal" to #newModal anchor:

<a href="#newModal" data-toggle="modal" data-dismiss="modal">Open NewModal</a>


Cannot find name 'PromiseConstructor' tinymce

Include in tinymce folder a file tsconfig.json with the following contents:

{

  "compilerOptions": { "lib": [ "es2015", "dom" ] },  "exclude": [ "**/bin", "**/bower_components", "**/jspm_packages", "**/node_modules", "**/obj", "**/platforms" ]

}

More at https://github.com/tinymce/tinymce/issues/6240


Add data-dismiss="modal" to #newModal anchor:

<a href="#newModal" data-toggle="modal" data-dismiss="modal">Open NewModal</a>


Prevent Firing Multiple Concurrent Click  Events on Same Element


Html (just as example):

<!DOCTYPE html>

<html>

<body>

<p class="test">Click on this paragraph.</p>

<p class="test">Click on this paragraph2</p>

</body>

</html>


Wrong JS

  $(".test").click(function(){

    alert($(this).html());

  });

///some more code....

//need to bind click again

   $(".test").click(function(){

    alert($(this).html());

  });

//Now when you click an element of class  "test", the alert will fire twice (boom!!!).


Correct JS

  $(".test").click(function(){

    alert($(this).html());

  });

///some more code....


//need to unbind previous click handlers to prevent multiple concurrent firing

   $(".test").off("click");

//need to bind click again

   $(".test").click(function(){

    alert($(this).html());

  });