2010-07-20 2 views
0
경고

감안할 때 트리거 :포토샵 - 요소의 현재 값이!로 끝나는 경우,

var value = $this.text(); 

값과 동일한 경우 : 남 영양 두려움 전혀. 성능 현재 초콜릿 소스. Morbi의 erat의 turpis는 consequat의 NEC, 된 Lacinia 예를 들어, 나오지도에서 lobortis. 소스 나 샐러드에서 플레이어 공항, 수소 및 공제 채팅.

때 사용자 유형에 : 같은 값이, 남 영양에 두려움이없는 곳. 성능 현재 초콜릿 소스. Morbi의 erat의 turpis는 consequat의 NEC, 된 Lacinia 예를 들어, 나오지도에서 lobortis. 소스 나 샐러드에서 채팅 플레이어 공항, 수소 및 공제.!

3!

1 자바 스크립트 나 다른 함수를 호출 할 수 있도록 알려드립니다.

1'm

if (/!!!$/.test(value)) {} but that doesn't seem to be working. 

아이디어를 사용하려고? !!!\n이 같은

+1

한다고 작동 할 수 있습니다. 조금 this.text'$()'정말이 포함되어 예상 값을 걱정 1'm? –

+0

은 손질 할 필요가 밝혀? thxs – WozPoz

답변

1

는 것 같습니다. 정규식 여러 줄을 만들기위한 /m 플래그를 사용하십시오.

if (/!!!$/m.test(value)) { 
    console.log("it works"); 
} 

확인이 :

var s = "When the user tl, sem.The 3 !!!"; 

if (/!!!$/m.test(s)) 
    console.log("multiline matches"); //prints 

if (/!!!$/.test(s)) 
    console.log("single line matches"); //prints 

s += "\n"; 

if (/!!!$/m.test(s)) 
    console.log("multiline matches"); //prints 

if (/!!!$/.test(s)) 
    console.log("single line matches"); //doesn't print 
0

이 코드는 jQuery를 개체에 메모 변환이 잘되지 작동, 다음

var value = $(this).text(); 
0

은 $이 자기를 참조 않습니다 사용합니다. $ (이)를 자체를 의미합니다.

var value = $(this).text(); 

전체 예 : 그래서 같이해야합니다.

<body> 
    <p>hello!!!</p> 
    <p>done</p> 
</body> 
<script> 
    $(document).ready(function() 
    { 
     $("p").click(function() 
     { 
      var value = $(this).text(); 
      if (/!!!$/.test(value)) { msg = 'done';}else{ msg = 'not done';} 
      alert(msg); 
     }); 
    }); 
</script> 
관련 문제