Click here to Skip to main content
Sign Up to vote bad
good
I have created a custom jQuery function in my web application and it is working fine without master pages, now I have a master page and i have added a reference to my .js file on the Content page and call the custom js method then it gives me error like
 
Type error: object function (selector, context){ //the jquery object is actually just the constructor 'enhanced' return new jQuery.fn.init(selector, context, rootjQuery); }has no method 'myCustomMethod'
i am calling the custom method like:
  $(document).ready(function () {
            $('#btnTest').click(function () { 
                try {
                    $.myCustomMethod('testing title!', 'popup.aspx', 600, 400);
                } catch (e) {
                    alert(e);
                }
            });
        });
my js code is
 
(function ($) { 
$.fn.myCustomMethod = function (title, src, width, height) {
 // all my code here }; 
})(jQuery);
 
any help would be greatly appreciated.
Posted 9-Sep-12 19:51pm


1 solution

<div>
<input type="button" id='btnSun' text="Clickme"/>
<div id ='aaa'>hey</div>
</div​>​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​
 
$(document).ready(function() {
  $('#btnSun').click(myFunction);
  $('#aaa').hide();
});
function myFunction() {
  $('#aaa').show();
}
 

Please Mark as ANSWER if this solution helped u
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Christian Graus 488
1 Ron Beyer 306
2 Tadit Dash 253
3 samadhan_kshirsagar 229
4 OriginalGriff 198
0 Sergey Alexandrovich Kryukov 7,041
1 Prasad_Kulkarni 3,815
2 OriginalGriff 3,557
3 _Amy 3,372
4 CPallini 3,034


Advertise | Privacy | Mobile
Web02 | 2.6.130619.1 | Last Updated 13 Sep 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid