Uncaught TypeError: $(…).on is not a function

Coding Duchess

I am using JQuery UI dialog on my page and getting this error

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>Test</title>

    <script src="Scripts/jquery-1.6.4.js"></script>
    <script src="Scripts/jquery-ui-1.11.4.js"></script>
    <script>
        $(document).ready(function () {
            $(".hlk1").on("click", function () {
                var linkId = $(this).attr("linkID");
                alert(linkId);
                // initialize dialog
                var dlg = $("#dialog").dialog({
                    autoOpen: false,
                    modal: true,
                    draggable: false,
                    resizable: false,
                    position: ['center', 'top'],
                    height: 380,
                    width: 530,
                    dialogClass: 'ui-dialog-osx',
                    buttons: {
                        "Done": function () {
                        $(this).dialog("close");
                    }
                }
            });

            // load content and open dialog
            dlg.load('page2.html?id=' + linkId).dialog('open');
        });
});
</script>
</head>

<body>

<a href="#" class="hlk1" linkid="305">Click here</a>
<br/>
<a href="#" class="hlk1" linkid="890">Click here</a>
<br/>
<div id="dialog"></div>
</body>
</html>

Can anyone help me figure that one out? It might be the JQuery version but this is the version Visual Studio installed through NuGet package manager

Andrew Brooke

.on() was introduced in jQuery 1.7, but it looks like you are running 1.6.4. If you can't change the version, you should just be able to change your function to .click

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

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Uncaught TypeError: Function is not a function

Uncaught TypeError: $(...).jsGrid is not a function

Uncaught TypeError: $(...).accordion is not a function

Uncaught TypeError: $(...).formSelect is not a function

Uncaught TypeError: $(...).stellar is not a function

Uncaught TypeError: $(...).tooltip is not a function

Uncaught TypeError: $(...).pickadate is not a function

Uncaught TypeError: $(...).ready is not a function

Uncaught TypeError: 'download' is not a function

Uncaught TypeError: $(...).tableDnD is not a function

Javascript: Uncaught TypeError: not a function

Uncaught TypeError: #<Object> is not a function

Uncaught TypeError: $.post is not a function

Uncaught TypeError: map is not a function

Uncaught TypeError: Object (...) is not a function

Uncaught TypeError Object is not a function

Uncaught TypeError: .slideToggle is not a function

Uncaught TypeError: $(...).waterwheelCarousel is not a function

"Uncaught TypeError: $ is not a function" in WordPress

Uncaught TypeError: .unshift is not a function

Uncaught TypeError: dispatch(...).then is not a function

Uncaught TypeError: $(...).selectize is not a function

Uncaught TypeError: $ is not a function on weebly

Uncaught TypeError: getFullYear is not a function

Uncaught TypeError: $(...).draggable is not a function

Uncaught TypeError: a(...).countdown is not a function

Uncaught (in promise) TypeError: $ is not a function

Uncaught TypeError: $(...).lightGallery is not a function

REACT Uncaught TypeError .then is not a function