JavaScript Binding event on elements having “left: 0px” event binding for elements

<span class="switchery switchery-small" style="box-shadow: rgb(223, 223, 223) 0px 0px 0px 0px inset; border-color: rgb(223, 223, 223); transition: border 0.4s, box-shadow 0.4s; background-color: rgb(255, 255, 255);">
    <small style="left: 0px; transition: background-color 0.4s, left 0.2s;"></small>
</span>

I'm using a plugin and it generated above code. How can I select switchery that it has small tag that its left is 0px?

I wrote this

if ($('.switchery').find('small').attr('style').indexOf('0px') > -1) {

}

but how can I apply click() my matches element.

Answer:1

You can write like this :

if ($('.switchery').has('small').find('small').css('left') == '0px') {
    // if matches
    // do click operation here
    $('.switchery').click()
    // or
    $('.switchery').click(function () {...
    });
}

DEMO

Answer:2

I'm using the body-parser package like this: // For parsing application/json: app.use(require('body-parser').json()); // For parsing application/x-www-form-urlencoded app.use(require('body-parser')....

I'm using the body-parser package like this: // For parsing application/json: app.use(require('body-parser').json()); // For parsing application/x-www-form-urlencoded app.use(require('body-parser')....

I'm doing some analysis on a large base, mostly javascript (it's actually mostly Siebel eScript, but that's more or less the same thing, grammatically) Over the years, bad programmers have been in ...

I'm doing some analysis on a large base, mostly javascript (it's actually mostly Siebel eScript, but that's more or less the same thing, grammatically) Over the years, bad programmers have been in ...

  1. strip comments from html
  2. strip comments from c code
  3. strip comments from json
  4. strip comments from css
  5. strip comments from xml
  6. strip comments from python
  7. strip comments from word document
  8. strip comments from java
  9. strip comments from c++ file
  10. python strip comments from file
  11. bash strip comments from file
  12. python strip comments from line
  13. linux strip comments from file
  14. php strip comments from html
  15. python strip comments from json
  16. python strip comments from sql
  17. gulp strip comments from html

I need to find a very performant way to find out if a custom element or any of its parent elements has display: none; First approach: checkVisible() { let parentNodes = []; let el = this; ...

I need to find a very performant way to find out if a custom element or any of its parent elements has display: none; First approach: checkVisible() { let parentNodes = []; let el = this; ...

How can I share pdf file link or image link which will open in react native mobile app web browser. I have added a share button but when the user clicks on it, it opens where to share menu options ...

How can I share pdf file link or image link which will open in react native mobile app web browser. I have added a share button but when the user clicks on it, it opens where to share menu options ...