Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Trying out jquery, but things are not working out

 
Rahul Shivsharan
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the code below has 2 buttons 'CLICK-ME' and 'AGAIN-AGAIN'

on the click of first button all the empty td's get filled with text .

now what i'm trying to do is on click of second button just remove the text in
td's and add a new text . But the second functionality is not happening .

can anybody please help me out or just give a hint

 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you want to read what empty is: http://docs.jquery.com/Manipulation/empty

Does that sound like what you want?

Why are you using that filter?

Eric
 
Rahul Shivsharan
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm using filter to filter out those td's whose child node type is text ,
or else it will fill the new text in those td's which has child node input


and i added empty(), because first it will empty the text in between td's and than add new text.

This is what i was trieng to do
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64715
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rahul Shivsharan wrote:i'm using filter to filter out those td's whose child node type is text ,
or else it will fill the new text in those td's which has child node input

Huh? There's nothing there. This is completely unnecessary and pointless. And you don't need to empty the element first -- the existing content will be automatically replaced.

The best way to make sure that something doesn't work is to over-think it. Just keep it as simple as possible.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:This is completely unnecessary and pointless.

And gratuitous and extraneous!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic