First of all I am new to this joomla CMS. I have a joomla project. here i have customized the userprofile plugin and added some more fields .
in registration form i need an extra button named "Save for later ". thus my form contains 3 button ( save for later, Register and cancel )

i need to write a javascript function in the onclick event of "save for later button ".

So i have done

In components/com_user/views/registration/tpl/default.php I have created a button as in normal way. and wrote a javascript function call on this

And for your problem your are using the input type as submit that why your form will submitted and your function was not call. You can use type as button then your task will be done.Replace your input field with this.