Debugging Jquery
in Getting Started
•
12 years ago
Hi,
I am a bit new to Jquery and would like to know how you guys debug it. (I am reasonably good with Java and C# - but I dont know much of JavaScript and jQuery.) I use FireBug right now - but I dont have much experinence with it.
For example, I have a HTML table, where one column is a button. I attempted to delete the row containing the button that was clicked according to the discussions at http://stackoverflow.com/questions/170997/what-is-the-best-way-to-remove-a-table-row-with-jquery
In doing so, I attempted to try the following
- function deleteRow() {
- $(this).parent().parent().remove();
- }
This does not work. I think I might be selecting something wrong. I attempted to debug this by modifying my original function doing something like:
- function deleteRow() {
- var $t = $(this);
- alert($t);
- var $t1 = $(this).parent();
- alert($t1);
- $(this).parent().parent().remove();
- }
and I tried stepping through the method, and in the watch window in FireBug I just see $t and $t1 as [Window temp.html] (temp.html is the name of the file). This does not tell me the object that is contained in either $t or $t1. I am comparing this to debugging Java, where we can see the type of object associated with each variable.
The alert boxes above use useless too. I just get an [object Object] – which does not give me any useful information other than that the variable is not null.
I am wondering if someone can provide me some clues.
Thanks,
O.O.
1