2012-06-08 8 views
1

JQuery에서 뭔가를 수행하는 방법을 알아 내려고하고 있는데 약간의 도움이 필요합니다. 내가해야 할 일은 RegEx 검색과 특정 분야의 검색입니다. (임의의 숫자와 번호를 대체) 그들은 모두 기본적으로 그들이 options_number_text 한 JQuery 문제 - Magento 사용자 정의 필드

options_22_text 
options_23_text 

아래에 같은 이름을 가지고,

나는 기본적으로 젠토 저장소를 가지고, 그것은 3 개 사용자 정의 필드가 있습니다. 내가 픽업 3 사용자 정의 필드를 필요로 각 페이지에 대해

은 (순서대로 그들은 페이지에 표시됩니다)과

이것은 내가 지금까지 가지고 것입니다,하지만 숫자가 변경되기 때문에 작동하지 않습니다 모든 페이지에 대해

jQuery(document).ready(function() { 
    if (jQuery('#options_3_text').length > 0){ 
     //Custom Options - Template: Description.phtml 

     jQuery('#options_2_text').click(function() { 
      //Make sure other fields are filled out first 
      if (jQuery('#options_3_text').val() == "") { 
       alert('You must enter the first line!'); 
       jQuery('#options_3_text').focus(); 
      } 
     }); 

     jQuery('#options_1_text').click(function() { 
      //Make sure other fields are filled out first 
      if (jQuery('#options_3_text').val() == "") { 
       alert('You must enter the first line!'); 
       jQuery('#options_3_text').focus(); 
      } 
     }); 
    } 
}); 

기본적으로 사용자는 가격을 조정하기 때문에 첫 번째 텍스트 필드를 채워야합니다. 이 일을하는 좋은 방법을 찾아야합니다 - 도와주세요!?

답변

2

$("input[id^=options_]") 모든 입력 요소는 옵션 _

으로 시작해야합니다.