admin管理员组

文章数量:1026989

I want to stop (break) in the first function called whenever a submit button is pressed in a form. How can I set a break-point for this in Firebug?

I know how to stop in any line in a function. But in one case I don't know which function is getting called upon pressing "submit" button.

I want to stop (break) in the first function called whenever a submit button is pressed in a form. How can I set a break-point for this in Firebug?

I know how to stop in any line in a function. But in one case I don't know which function is getting called upon pressing "submit" button.

Share Improve this question edited Apr 25, 2012 at 2:33 KatieK 13.9k19 gold badges78 silver badges91 bronze badges asked Mar 31, 2011 at 8:08 user5858user5858 1,2217 gold badges42 silver badges84 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 4

So your real problem is that you don't know which function is being called (once you know that you can use breakpoints).

Try enabling the 'Net' tab, select 'All' and click 'Persist'. This will show you a list of functions that are being called. Hit the submit button and expand the first function in the list. This is the first function being called after submitting.

Open Firebug, go to the script tab and select the script you want. I think you can either click the number of the line (on the left), or on the right hand panel you can create "breakpoints" which will stop the script at the points you designate.

Type this into the Firebug console - it will stop any form on that page from submitting and display the id. You will need to include jquery with the page if you haven't already.

$("form").submit(function() {
  console.log(this.id);
  return false;
});

I want to stop (break) in the first function called whenever a submit button is pressed in a form. How can I set a break-point for this in Firebug?

I know how to stop in any line in a function. But in one case I don't know which function is getting called upon pressing "submit" button.

I want to stop (break) in the first function called whenever a submit button is pressed in a form. How can I set a break-point for this in Firebug?

I know how to stop in any line in a function. But in one case I don't know which function is getting called upon pressing "submit" button.

Share Improve this question edited Apr 25, 2012 at 2:33 KatieK 13.9k19 gold badges78 silver badges91 bronze badges asked Mar 31, 2011 at 8:08 user5858user5858 1,2217 gold badges42 silver badges84 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 4

So your real problem is that you don't know which function is being called (once you know that you can use breakpoints).

Try enabling the 'Net' tab, select 'All' and click 'Persist'. This will show you a list of functions that are being called. Hit the submit button and expand the first function in the list. This is the first function being called after submitting.

Open Firebug, go to the script tab and select the script you want. I think you can either click the number of the line (on the left), or on the right hand panel you can create "breakpoints" which will stop the script at the points you designate.

Type this into the Firebug console - it will stop any form on that page from submitting and display the id. You will need to include jquery with the page if you haven't already.

$("form").submit(function() {
  console.log(this.id);
  return false;
});

本文标签: javascriptHow to stop in FireBug when submit button is pressedStack Overflow