저는 몇 시간 동안이 작업을 해왔습니다. 내 양식 중 하나만 작동하거나 전혀 작동하지 않습니다. 나는 폼 함수를 얻거나 아무것도 할 수없는 함수를 제출할 수 없다. 그것은 단지 모든 것을 불가능하게하고 제출하지 않습니다. 어떤 도움을 주셔서 감사합니다.jQuery는 입력을 기반으로 다른 양식을 모든 숫자 또는 문자로 제출하도록합니다.
기본적으로 첫 번째 양식의 입력 필드 인 "s-webref"의 항목을 기반으로 제출하려는 두 가지 양식이 있습니다.
"s-webref"에 숫자가 모두 입력 된 경우 첫 번째 양식 인 "property-webref-search"를 제출하십시오.
그렇지 않은 경우 두 번째 양식 "속성 검색"을 제출하십시오. (상단에 위치)
내 첫 번째 양식 :
<form name="property-webref-search" id="property-webref-search" method="get" action="<?php bloginfo('url'); ?>/">
<input type="text" class="text webref" id="s-webref" name="s" value="<?php _e('İlan no veya arama', 'woothemes'); ?>" onfocus="if (this.value == '<?php _e('İlan no veya arama', 'woothemes'); ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e('İlan no veya arama', 'woothemes'); ?>';}" />
<input type="submit" class="submit button" name="property-search-webref-submit" id="property-search-webref-submit" value="<?php _e('ara', 'woothemes'); ?>" />
</form>
내 두 번째 형태 :
$('#property-search-webref-submit').click(function() {
var searcherz = $("input#s-webref").val();
if(searcherz.match(/^\d+$/)) {
$('form#property-webref-search').submit();
}
else {
$('form#property-search').submit();
}});
: 이것은 그 형태가 전혀 작동하지하게 사용되는 자바 스크립트가
<form name="property-search" id="property-search" method="get" action="<?php bloginfo('url'); ?>/">
<input type="text" class="main-query text" id="s-main" name="s" value="<?php if ($keyword != '') { echo $keyword; } else { _e('Arama...', 'woothemes'); } ?>" onFocus="if (this.value == '<?php _e('Arama...', 'woothemes') ?>') {this.value = '';}" onBlur="if (this.value == '') {this.value = '<?php _e('Arama...', 'woothemes') ?>';}" />
<input class="view-button" type="submit" value="<?php _e('ara', 'woothemes') ?>" name="property-search-submit" />
</form>
너는 자바 스크립트 (유효성 검사 외에) – VeXii
@VeXii 실패한 자바 스크립트를 추가하기 위해 편집 됨. 나는 그것이 좋을 것이라고는 생각하지 않지만. –