jquery - How to do something to when using td+td to first td -


https://jsfiddle.net/tad564ys/28/

    var donotcountbye = true;      var byeweek = function() {         var result = "";         if(donotcountbye) {             result = result + "td.new+td:contains('bye')";         }         return result;     }  $(byeweek()).css('background', 'green'); 

how can td.new when using td.new+td

html

<table> <tr><td class="new">text</td><td>bye</td></tr> </table> 

since byeweek function, need call parenthesis ():

$(byeweek()).css('background', 'green'); 

fiddle: https://jsfiddle.net/lmgonzalves/tad564ys/22/

edit:

you can use .prev(), this:

$(byeweek()).prev().css('background', 'green'); 

fiddle: https://jsfiddle.net/lmgonzalves/tad564ys/34/


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -