Skip to main content
 首页 » 编程设计

jquery之无法重置选择工作

2026年07月28日5xing901022

我正在开发一个网站,我需要重置我的表单,该表单是使用 jQuery Uniform 构建的,但问题是我无法进行任何重置。

这是我的标题代码:

$j(function()  
{ 
    // Binds all buttons and events  
    $j('#changecountry').click(countryPopup); 
    $j('#catalogsearch').click(toggleSearch); 
    $j('#closesearch').click(toggleSearch); 
 
    /* Centers content on page according to phone width */ 
    centerContent('.header-links', '.header-links ul'); 
    centerContent('.footer-links', '.footer-links ul'); 
 
    /* Other instancing */ 
    $j('select').uniform({ 
        resetSelect:    '.reset' 
    }); 
 
    $j('input[type=radio]').uniform(); 
    $j('input[type=checkbox]').uniform(); 
    activateLinks(); 
    arrow_position(); 
    front_page_accordion(); 
 
}); 

下一部分是如下所示的表单:

<select class="uniform gift-layer" name="cost" id="cost"> 
<option value="0"><?php echo $this->__('What is your price range?'); ?></option> 
<?php foreach($prices as $price) : ?> 
    <option value="<?php echo $price['value']; ?>"><?php echo $price['label']; ?></option> 
<?php endforeach; ?> 
</select> 

有谁能告诉我这是怎么回事吗?

请您参考如下方法:

$j('select').uniform({ 
    resetSelector:    '.reset' 
 }); 

而不是

$j('select').uniform({ 
        resetSelect:    '.reset' 
}); 

来源:http://uniformjs.com/#resetSelector