javascript - Confirmation/Success message does not display -
i have simple wishlist script written in javascript adds item wishlist. script adds item user's list can't seem display success message.
i'm using code below seek , display success message.
function additem(todoitem) { if ((todoitem != null) && (todoitem != "undefined" )) { numtodoitems++; setcookie('pt_todoitem'+numtodoitems, todoitem, exp); setcookie('pt_numtodolist',numtodoitems, exp); $(window).humanmsg('added '+todoitem+' wishlist'); } }
can please have @ code , provide me advice?
more info:
my html:
<div class="add-to-wishlist"> <a href="javascript:additem('<?php print htmlentities($title, ent_quotes); ?>')"> <img class="add-to-wishlist" src="/images/add-to-wishlist-button.gif" border="0" /></a> </div>
here humanmsg. plugin jquery
(function($, window){ $.fn.humanmsg = function( message, options ) { homecoming this.each(function(){ var container = == window || == document ? document.body : this; !$.data(container, 'humanmsg') && $.data(container, 'humanmsg', new $.humanmsg (container, message, options) ); }); }; $.humanmsg = function( container, message, options ) { if (typeof message == 'object') { options = message; message = null; } var s = $.extend({}, $.humanmsg.defaults, options); var $m, sizecontainer = container == document.body ? window : container; $m = $('<div class="humanized-message '+s.addclass+'"/>') .html(message || s.message) .click(remove) .appendto(container); $m.css({ display: 'none', visibility: 'visible', top: ($(sizecontainer).height()-$m.innerheight())/2, left: ($(sizecontainer).width()-$m.innerwidth())/2 }) .fadein(s.speed); s.autohide && settimeout(remove, s.autohide); function remove() { $m.fadeout(s.speed, function(){ $m.remove(); $.removedata(container, 'humanmsg'); }); } }; $.humanmsg.defaults = { message: 'no message set', autohide: 3000, addclass: '', speed: 300 }; })(jquery, this);
looking error console have this:
uncaught typeerror: property '$' of object [object window] not function (anonymous function) closing script tag manually
javascript
No comments:
Post a Comment