Ok, so I went from this:
<script type="text/javascript">
$.fn.justATest = function () {
    alert("inside justATest");
};
</script>
<a href="#" onclick="$(this).justATest(); return false;">original
link</a>

to this:
<a href="#" id="someID">new link</a>
<script type="text/javascript">
(function($){
    $.fn.justATest = function () {
        alert("inside justATest");
    };

    $("#someID").click(function () {
        alert("inside click");
        $(this).justATest();
        return false;
    });
})(jQuery.noConflict());
</script>

That works.

Thanks all for your input!

Adam

On Dec 4, 5:44 pm, Zach Leatherman <[EMAIL PROTECTED]> wrote:
> I believe Adam is in the beginning stages of developing applications
> for the Oracle Portal platform.  He has a few portlets that also are
> shown as standalone pages (thus why, at least for now, they both have
> the jquery script; obviously that's not an ideal solution).  We
> noticed this behavior and wanted to see what you guys thought.
>
> I assume, also, that's why a lot of developers scope their code with a
> closure, and pass in the jQuery object (as has been suggested on the
> jQuery blog before)
>
> <script src="jquery.js" type="text/javascript"></script>
> <script type="text/javascript">
> (function($)
> {
>   // all of my code here.
>
> })(jQuery.noConflict());
>
> jQuery('#myElement').click(function()
> {
>   // not safe, a reference to jQuery here has no guarantee that it
> will be the jQuery I included, correct?});
>
> </script>
>
> That way, if a bookmarklet was fired and overwrote jQuery, your event
> handlers and any code that might execute after the bookmarklet would
> still have a reference to the original.
>
> Points well taken, thanks for all the responses.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to