What happens if we link the same div twice in the js file and one of them as an inline script

this is inside javascript file

what happens if i have the same bindings for the same div defined twice //

$(document).ready(function() { $("#divid").click(function() { // some logic here }); }); 

it's like inline

 <script language="javascript" type="text/javascript"> $(document).ready(function() { $("#divid").click(function() { // some logic here }); }); </script> 
+2
source share
1 answer

The result will be that both handlers will execute in the order in which they were connected (unless the first one interrupts the event, for example, return false ).

The order they are associated with is the order in which the <script> elements enter, since the .ready() handlers are also in the queue in order.

+4
source

Source: https://habr.com/ru/post/1347655/


All Articles