Freelance Project Requests info@CodeDocu.de Software Development in C# WPF Asp.Net Core Vba Excel Word SQL-Server EF Linq, UWP Net
#

 

 

Problem:

jQuery events .click and .mouseenter do not work

 

In my jQuery script, the jquery event assignment does not work.

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

  alert("Handler for .click() called.");

  });

 

$("body").on("mouseenter", "img", function () { alert("Handler for .click() called."); });

 

Solution:

Sometimes the solution is very simple.

If you want to describe functions and events with jQuery and javascript, you have to define the library - before -.

That means you have to first script src = ".." put

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<script>

            //----< events >----

            //$("ctlEditor_Text").ready(Text_to_HTML);

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

                alert("Handler for .click() called.");

            });

..

 

Test script

        @*------------< script: Image-Tools >------------*@

        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

 

        <script>

            //----< events >----

            //$("ctlEditor_Text").ready(Text_to_HTML);

            //$("img").click(function () {

            //    alert("Handler for .click() called.");

            //});

 

            //("#ctlEditor_Text"

            $("body").on("mouseenter", "img", function () { alert("Handler for .click() called."); });

 

 

            $(document).ready(function () {

                $("p").mouseenter(function () {

                    $("p").css("background-color", "yellow");

                });

                $("p").mouseleave(function () {

                    $("p").css("background-color", "lightgray");

                });

            });

            //----</ events >----

 

 

            //----< functions >----

 

            function image_Tools() {

                alert("test");

            }

 

 

        </script>

        @*------------</ script: Image-Tools >------------*@

 

Mobile
»
jQuery: function click does not work
»
uncaught TypeError childrenSelectorAll is not a function

.

Contact for Jobs, Project Requests: raimund.popp@microsoft-programmierer.de