"Object does not support this property or method" error - jQuery

I have a problem with leverage notification in jquery. I have this error in IE (which I do not know is the best option for testing your code, but only for your error in javascript) "The object does not support this property or method."

notifyBidding.js

$(document).ready(function(){
    addNotice();
    setTimeout(function(){
    addNotice();
    },4000);        
$('#growl')
    .find('.close')
    .live('click', function(){
        $(this)
            .closest('.notice')
            .animate({
            border: 'none',
            height: 0,
            marginBottom: 0,
            marginTop: '-6px',
            opacity: 0,
            paddingBottom:0,
            paddingTop:0,
            queue:false
            },1000, function(){
                $(this).remove();
        });
        });
});

function addNotice(){
$('#growl')
.append($('<div id="bidTo"></div>').html($('<img id="bg2" src="notification.png" width="250" height="75"></img><p id="tag2">This item is about to end</p><img id="dp2" src="temporary.jpg"/><p id="bidTime" style="font-family:arial narrow; font-size:12; color:rgb(171,14,21); text-transform:uppercase; position:absolute; top:25px; left:85px"><b>about to end</b></p>')))
.hide()
.appendTo("#growl")
.fadeIn(1000)
.fadeOut(3000)

$('#bidTo').contents().unwrap();

}

welcome.php

<html>
    <head>
        <link rel="stylesheet" type="text/css" href="design2.css"/>
        <script  type="text/javascript" src='script.js'></script>
    </head>

    <script type="text/javascript" src="jquery-1.11.0.min.js"></script>
    <script src="jquery-1.11.0.min.js"></script>
    <script src="jquery-ui-1.10.4.custom/js/jquery-ui-1.10.4.custom.min.js"></script>
    <script src="notification.js"></script>
    <script src="notifyBidding.js"></script>

<body>

<a id='imgCart' href='#'></a>


<div id='notification' >
    <img id='bg' src='notification.png' width='1110' height='65'></img>
    <p id='tag'>There are still &nbsp;&nbsp; in your shopping cart</p>
    <p id='noToPay'>5</p>
</div>

<div id='growl'></div>


</body>
</html>
+4
source share
1 answer

You need to place <script>in the section <head>or before closing the tag of </body>your page.

<head>
    <link rel="stylesheet" type="text/css" href="design2.css"/>
    <script  type="text/javascript" src='script.js'></script>
    <script type="text/javascript" src="jquery-1.11.0.min.js"></script>
    <script src="jquery-1.11.0.min.js"></script>
    <script src="jquery-ui-1.10.4.custom/js/jquery-ui-1.10.4.custom.min.js"></script>
    <script src="notification.js"></script>
    <script src="notifyBidding.js"></script>
</head>

, jQuery 1.11 .live() 1.9, .on(), :

$('#growl').find('.close').live('click', function(){ .....

$('#growl').find('.close').on('click', function(){ .....

, scripts.js jQuery , jQuery .

: jQuery , , , .

+5

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


All Articles