반응형

jQuery 데이터 속성 값을 기반으로 요소를 찾는 방법은 무엇입니까?

jQuery how to find an element based on a data-attribute value?

 

jQuery how to find an element based on a data-attribute value?

I've got the following scenario: var el = 'li'; and there are 5

  • 's on the page each with a data-slide=number attribute (number being 1,2,3,4,5 respectively). I now need to find the cur...

     

    stackoverflow.com

I've got the following scenario:

var el = 'li';

and there are 5 <li>'s on the page each with a data-slide=number attribute (number being 1,2,3,4,5 respectively).

I now need to find the currently active slide number which is mapped to var current = $('ul').data(current); and is updated on each slide change.

So far my tries have been unsuccessful, trying to construct the selector that would match the current slide:

$('ul').find(el+[data-slide=+current+]);

does not match/return anything…

The reason I can't hardcode the li part is that this is a user accessible variable that can be changed to a different element if required, so it may not always be an li.

반응형
반응형

How to format $.now() with Jquery

 

$.now() gives me the time as miliseconds. I need to show it something like hh:mm:ss

$ .now ()는 시간을 밀리 초 단위로 제공합니다. hh : mm : ss와 같이 표시해야합니다.

How to format $.now() with Jquery

 

function formatTimeOfDay(millisSinceEpoch) {
  var secondsSinceEpoch = (millisSinceEpoch / 1000) | 0;
  var secondsInDay = ((secondsSinceEpoch % 86400) + 86400) % 86400;
  var seconds = secondsInDay % 60;
  var minutes = ((secondsInDay / 60) | 0) % 60;
  var hours = (secondsInDay / 3600) | 0;
  return hours + (minutes < 10 ? ":0" : ":")
      + minutes + (seconds < 10 ? ":0" : ":")
      + seconds;
}

.

반응형
반응형

비판받지 않을 것이라고 믿는 것은 매우 순진한 생각이다.
비판은 인생의 일부분일 뿐이고, 비판을 받아들여야 한다.
내가 사람들에게 말하고 싶은 한 가지는
만약 당신이 무엇인가 새로운 것 또는 혁신적인 일을 하려면
기꺼이 사람들에게 오해받을 준비를 해야 한다는 것이다.
오해받을 생각이 없다면 영원히 새로운 것이나 혁신적인 것을 할 수 없다.
- 제프 베조스, 아마존 회장


혁신적인 것은 과거의 편안함을 깨는 것입니다.
혁신과 새로움은 필연적으로 오해, 저항, 비판과 함께 합니다.
손가락질 받을 가능성도 커집니다. 이런 비판에서 자유롭지 못하다면
남들이 어떻게 생각할까라는 의식에서 해방되지 못한다면
현재 수준을 넘어설 수 없습니다.

반응형
반응형

소설가들끼리
하는 농담이 있다.
"쓴 것을 가져오라.
당신이 어떤 사람인지 이야기해 주겠다."
나는 말보다 글을 믿고 글보다 행동을 더 믿는다.
장황하게 말만 늘어놓는 자문회의를 싫어하며,
선언적인 주장보다 그 주장에 이르기까지
내밀한 고민이 담긴 글을 원한다. 자신이
쓴 글대로 행하고자 애쓰는
사람들과 벗하고 싶다.


- 김탁환의《아름다움은 지키는 것이다》중에서 -


* 말은 쉽습니다.
말로 풀 때는 청산유수일 수 있습니다.
그러나 그것을 글로 써보라 하면 어려워합니다.
생각은 말로, 말은 글로 써야 정리가 되고
일목요연해지는데 결코 쉽지 않습니다.
고도의 훈련이 필요하기 때문입니다.
언제든 '쓴 것을 가져오는' 사람과
벗하면 인생이 즐겁습니다.
배울 게 많습니다.

반응형

'생활의 발견 > 아침편지' 카테고리의 다른 글

'그냥, 웃는 얼굴'이 좋다  (0) 2020.11.12
사랑을 잃고 나서...  (0) 2020.11.12
생애 최초로 받은 원작료  (0) 2020.11.09
너무 가깝지도, 너무 멀지도 않게  (0) 2020.11.09
흙의 냄새가 다르다  (0) 2020.11.09

+ Recent posts