The are several reasons for this error:
1.The jquery.ui is used before jquery.
2.The $ is used by another library.
3.The jquery lib that is referenced locally(wordpress) has different version from that using jquery.ui.
4.When the right library and version is referenced the browser cache must be cleared.
What do you think?