JavaScript Jquery click event not fire in last child? jquery click event not firing,jquery click event listener,jquery

this is my html code

<table id='code'>
    <tr>
        <td>data1</td>
        <td>data2</td>
        <td>data3</td>
        <td class='action'>data4</td>
    </tr>
    <tr>
        <td>data1</td>
        <td>data2</td>
        <td>data3</td>
        <td class='action'>data4</td>
    </tr>
    <tr>
        <td>data1</td>
        <td>data2</td>
        <td>data3</td>
        <td class='action'>data4</td>
    </tr>

jquery code is.

$('#code tr td').on('click',function(){
alert($(this).html());
});

this is my jquery code this is working. this fire click event on all td tags.

but I want click event fire only first three td not in td.action means last td.

Answer:1

You can use :not() or .not() to ignore a set of elements matching the selector

$('#code tr td:not(.action)').on('click',function(){
    alert($(this).html());
});

Demo: Fiddle

or

$('#code tr td').not('.action').on('click',function(){
    alert($(this).html());
});

Demo: Fiddle

Answer:2

I just started using RequireJs. Only one problem. Can someone explain why the code inside the require block is not run on page refresh. It only runs when I clear the cache. example: require(['game','...

I just started using RequireJs. Only one problem. Can someone explain why the code inside the require block is not run on page refresh. It only runs when I clear the cache. example: require(['game','...

  1. window onload run function
  2. window onload run script
  3. window.onload not running
  4. window.onload function not running

It looks pretty easy but I'm unable to do it. I want to change the view after click on login button, this is my code: app.js Ext.require ('Ext.container.Viewport'); Ext.application({ name: 'MyApp',...

It looks pretty easy but I'm unable to do it. I want to change the view after click on login button, this is my code: app.js Ext.require ('Ext.container.Viewport'); Ext.application({ name: 'MyApp',...

  1. switch view in android
  2. switch view in outlook
  3. switch view in swift
  4. switch view in servicenow
  5. switch view in android example
  6. switch view in angularjs
  7. switch view in skyrim
  8. switch view in iphone
  9. switch in view mvc

I have an array which I want to order by date in Angular.js: <tr ng-repeat="er in vm.readerFeeds | orderBy:'-publishedDate'"> <td>{{er.publishedDate}}</td> </tr> The list ...

I have an array which I want to order by date in Angular.js: <tr ng-repeat="er in vm.readerFeeds | orderBy:'-publishedDate'"> <td>{{er.publishedDate}}</td> </tr> The list ...

  1. angular order by date
  2. angular orderby date pipe
  3. angular order by date desc
  4. angular orderby date not working
  5. angular orderby date string
  6. angular orderby date descending
  7. angularjs orderby date
  8. angularjs orderby date string
  9. angularjs orderby date not working
  10. angularjs orderby date desc
  11. angularjs orderby datetime
  12. angularjs orderby date format
  13. angular order by datetime
  14. angularjs orderby date and time
  15. angular 2 orderby date example
  16. angular 6 orderby date
  17. angular 2 orderby date
  18. angular ngfor orderby date
  19. angular 2 orderby date pipe
  20. angular 6 orderby date pipe

I'm using this expression: "g{field1}={field2}a".match(/{([^\{\}]+)\}/g) What I need is to get "field1" and "field2", but it returns an array with "{field1}" and "{field2}".

I'm using this expression: "g{field1}={field2}a".match(/{([^\{\}]+)\}/g) What I need is to get "field1" and "field2", but it returns an array with "{field1}" and "{field2}".

  1. regular expression match any character
  2. regular expression match string
  3. regular expression match python
  4. regular expression match word
  5. regular expression match number
  6. regular expression match exact string
  7. regular expression match anything
  8. regular expression match multiple words
  9. regular expression match space
  10. regular expression match whitespace
  11. regular expression match period
  12. regular expression match newline
  13. regular expression match substring
  14. regular expression match javascript
  15. regular expression match parentheses
  16. regular expression match end of string
  17. regular expression match special characters
  18. regular expression match all characters
  19. regular expression match group
  20. regular expression match character