Reputation: 477
I'm having an issue trying to NOT select a tablerow with the function:
$("tr").click(function(e) {
var row = jQuery(this)
//rest of code left off
});
Basically it finds all tablerows and adds click functionality that will open a edit modal that has a row with textboxes that are populated with info from the tablecells. The problem is that the tablerow in the modal is also getting the functionality so when a user goes to edit a value in a text box the all the values disappears...
So what I have been trying and failing is to filter the tr by id several way by using:
$("tr").not('trEdit').click(function(e) {
var row = jQuery(this)
and
$("tr not:'trEdit').click(function(e) {
var row = jQuery(this)
I've also played around with trying the second table and then not selecting it's table rows, but the tables aren't besides each other & the example I had was...no I haven't tried table[1] tr yet(now that I think about it)...
Please help...I'm going nuts trying to figure this out..
Thanks!!!!!
Upvotes: 0
Views: 5996
Reputation: 16455
Could you implement it this way? It would make your intentions much clearer.
$("#theClickableTable tr").click(function() {
...
})
Upvotes: 0
Reputation: 15946
Your problem is that the "trEdit" in your not filter should be either ".trEdit" or "#trEdit", depending on what you meant to do (note the dot and the hash).
Upvotes: 1
Reputation: 112160
The syntax is either $("tr:not(.trEdit)")
or $("tr :not(.trEdit)")
- depending on if the trEdit class applies to the tr or a sub-element.
However, I think your problem may have to do with event bubbling - you'll have to search for details on that, or wait for someone else to extend the answer, as I have to go now.
Upvotes: 3
Reputation: 29976
I've never used the ':not' syntax but the following should give you what you need for this example:
$("tr[id!='trEdit']").click(function(e) {
var row = jQuery(this)
Upvotes: 0