1

we have all luxury with Firebug , Editing Html (In-Browser ) , CSS (In-Browser ) , But if any one working with javascript , each and every time JavaScript file has to be edited and Refresh the browser . Can we not have the such facility with Javascript in FireBug ?

Thanks In Advance .

2 Answers 2

2

The thing is, JavaScript is not as simple as HTML or CSS. You can change the page's contents or the style at will and it just updates, but if you change the code... well, say you change myvar = 1 to myvar = 9999999 - that's quite a difference, and that could have an enormous impact on the page. Reloading is the only way around it.

However if you have a console on Firebug, you can redefine individual functions by copying their source, replacing the contents with something new, and assigning the new function to the old one's name. Just beware that you lose the closure the function was in if you do that.

Sign up to request clarification or add additional context in comments.

1 Comment

What does "you lose the closure the function was in" mean?
1

You can use command line editor to execute arbitrary JS. Here is a previous post on this: How to edit JavaScript in Firebug?

More on js console: http://getfirebug.com/commandline

The other thing you can do is set a break point and change a variable on the fly.

3 Comments

so , can it be possible to change the variable's value like this ? 'coz i also want to do such types of changes , if major changes couldn't be done .
absolutely you can. you can also execute any arbitrary javascript via command line in firebug.
but i am interested in Last line . how can we change the value at time of debugging . Is it the same by executing the code at console ? or is there any other ways to do .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.