Я использую этот метод для передать значение по умолчанию в поле выбора контактной формы 7. Он работает нормально, но мне очень нужно, чтобы он работал с радиополем.
Я попытался изменить jquery на:
jQuery(document).ready(function(){
// get contents of hidden input; store in variable
var val = jQuery("span.hiddendefault input").val();
// set the "selected" attribute for option with value equal to variable
jQuery('radio#style-one option[value=' + val + ']').attr('checked', 'checked');
});
и контактную форму 7 для:
[radio radio-525 id:style-one class:test-class "one" "two" "three" "four"]
но переключатель не проверяется как требуется. У кого-нибудь есть идеи, пожалуйста?
[EDIT] Сгенерированный HTML-код формы:
<span class="wpcf7-form-control-wrap radio-525">
<span id="style-one" class="wpcf7-form-control wpcf7-radio test-class">
<span class="wpcf7-list-item">
<input type="radio" name="radio-525" value="one" />
<span class="wpcf7-list-item-label">one</span>
</span>
<span class="wpcf7-list-item">
<input type="radio" name="radio-525" value="two" />
<span class="wpcf7-list-item-label">two</span>
</span>
<span class="wpcf7-list-item">
<input type="radio" name="radio-525" value="three" />
<span class="wpcf7-list-item-label">three</span>
</span>
<span class="wpcf7-list-item">
<input type="radio" name="radio-525" value="four" />
<span class="wpcf7-list-item-label">four</span>
</span>
</span>
</span>
<span class="wpcf7-form-control-wrap hiddendefault">
<input type="hidden" name="hiddendefault" value="three" />
</span>
<INPUT TYPE="button" value="i want this design!" onClick="parent.location='order-form?design-no=three'">
. Пожалуйста, смотрите отредактированный вопрос для сгенерированного html формы. - person circey   schedule 30.11.2012