last day (14 days later) » 

12:57 PM
0
A: How can i toggle table tr with jquery?

ebram khalilI think you got confused between Class and ID selectors: In your code for the table rows you are setting the id property through id=@counter (whihc is a bad idea and semantically very wrong), while in your JS code you are using class selector $('#CDRTABLE .'+i).toggle(); // see that . So, eithe...

 
Ok change to class="success @counter" so how can write toggle in jquery for that purpose?
 
@behzadrazzaqi , I understand that you need to toggle the visibility for your table rows. so your click() should work properly now
 
change my code to class="success @counter" now need to change toggle code ,how can write toggle code in jquery for class="success @counter"?
 
@behzadrazzaqi , why the need to change the toggle code? Isn't your problem that the click do nothing(due to wrong selector)?
 
$('#CDRTABLE ' + i.toString()).toggle(); dont work
 
12:57 PM
$('#CDRTABLE #' + i.toString()).toggle(); .. you forgot the #
 
codeshare.io/5wndMP my final code but so not work!
hi
 
can you put a breakpoint or debugger inside the click function to see what happen
 
what's happen in my code?
@ebramkhalil ok wait
 
yea, what happen when you click on the 'li'
 
ok please wait
i'm debuging now
please wait
 
1:02 PM
ok
 
can not debug my java script code in vs 2015
but when li click
show alert
my alert code run
 
@behzadrazzaqi, i mean debug in the browser
 
in try debug in internet explorer but can not debug
please wait
 
don't you have chrome or firefox? it's much easier
 
have chrome
in chrome how can i debug?
 
1:10 PM
write debugger; inside your js code .. then refresh your page while inspect/console window is open
 
ok please wait
my network is disconnect please wait
 
debug the project
and debugger run correct and dont get any error message or other message in line $('#CDRTABLE #' + i.toString()).toggle();
 
good. now, if you run $('#CDRTABLE #' + i.toString()) in console, do you get the correct/required element ?
 
ok please wait
run $('#CDRTABLE #' + i.toString()) in console and dont get any message
 
1:23 PM
then this selector is wrong
wait, sorry i got confused too
 
what your means wrong?
in console write any thing?
 
it should be $('#CDRTABLE .' + i.toString()) .. replace the second # with .
because we are using the class selector
 
$('#CDRTABLE .' + i.toString()) write in console?
 
yea, try it to make sure it selects the correct element
 
console write [tr.success.289]
 
1:26 PM
that's better .. so apply this to your code and see if it works
 
ok please wait
thats work my friend,thanks so so much
 
cool, you welcome
i would only ask you to mark my answer as solution
 

last day (14 days later) »