Jump to content

editing function code


es131245

Recommended Posts

Usual function are easly edited by

var script=$(document).ready;$(document).ready(function(){script; alert('document ready!');});

But how to edit functions in an object?

var class={one:function(){alert('1');}, two:function(){alert('2');}}
Link to comment
Share on other sites

You are being very vague. None of us know what "class.authorization" is, you haven't showed that. If you need to add code in front of other code, then why can't you just type the code there? What's the problem?

Link to comment
Share on other sites

You just write the code in, with your text editor, like you write any other code.If you are trying to programmatically change the CODE object, then you can just define a new function like this:

CODE.newfunction = function() {  // some other function}
If you are trying to programmatically change the auth function, you have to overwrite the function with a new one, which means you need to copy the code from auth and add your code to replace the function.
CODE.auth = function() {  // add the new code  // paste the current code}
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...