user198729
user198729

Reputation: 63646

Why <tr> is not removed when click on the No button?

What's wrong with the code?

$('<tr><td><input type="button" value="No" /></td></tr>')
.appendTo('table')
.find('input[type=text]')
.select()
.end()
.find("input[type='text'][value='No']")
.click(function() {$(this).parents('tr').remove();})

Upvotes: 0

Views: 63

Answers (1)

Canavar
Canavar

Reputation: 48088

You're selecting type=text at your selectors. Change them to type=button.

$('<tr><td><input type="button" value="No" /></td></tr>')
.appendTo('table')
.find('input[type=button]')
.select()
.end()
.find("input[type='button'][value='No']")
.click(function() {$(this).parents('tr').remove();})

Upvotes: 2

Related Questions