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 .

Virendra
  • 387
  • 1
  • 7
  • 15

2 Answers2

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.

Niet the Dark Absol
  • 320,036
  • 81
  • 464
  • 592
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.

Community
  • 1
  • 1
dbrin
  • 15,525
  • 4
  • 56
  • 83
  • 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 . – Virendra Jan 25 '12 at 06:10
  • absolutely you can. you can also execute any arbitrary javascript via command line in firebug. – dbrin Jan 25 '12 at 06:13
  • 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 . – Virendra Jan 25 '12 at 06:34