How to override widget functions or extend

How to override widget functions or extend

Hi,

I'm looking for best approach to override widget functions.

For example
I was trying to override changePage function like this.  I was looking to implement a condition check around 

active.url code.

I'm also looking to override selectmenu with dialog box where i need to position close button to the right corner. 

  1. $.mobile.changePage =  function(){

  2. }