2
<div class="masterform type-selection">


<div class="radio"><span><input type="radio" name="feature_value_6" value="10" required=""></span></div><label>Cool</label>



function ShowLoading() {

var verif = true;

$(".masterform input").each(function() {
if($(this).val() == ""){
verif = false;
}
});
var radio = false;
$(".type-selection div.radio span").each(function() {
if($('.masterform input[type=radio]:checked').size() > 0){
radio = true;
}
});

if(verif == true && radio == true){
window.loading_screen = window.pleaseWait({
blabla }); }

}

i tried everything , the variable send me true but when i use this verification on radio input nothing work. my function work only when i stop the submit on my form by clicking on the cross of my safari navigator !

Everything works fine on chrome but cant make it work on safari

2 Answers 2

1

I cleaned up your code. Looks like you just need to use length instead of $.size()

var radio = false;
$(".type-selection div.radio span").each(function() {
  if ($('.masterform input[type=radio]:checked').length > 0) {
    radio = true;
  }
  console.log(radio);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="masterform type-selection">
  <div class="radio">
    <span>
      <input type="radio" name="feature_value_6" value="10" required="" checked>
    </span>
  </div>
  <label>Cool</label>
</div>

Sign up to request clarification or add additional context in comments.

7 Comments

just tried same thing not working until i stop the page charge by cross on navigator
@jolo "page charge"? What does that mean?
when the page is loading
@jolo you need to be more specific and give more context. I don't know what you're talking about. Give us a working demo that shows the problem clearly.
my function is called onSubmit form ! it work perfectly on chrome but on safari it work only when i stop the loading on the page by click the cross of the navigator :/
|
0

Try to use the "prop" property of jQuery, like this:

$(".type-selection div.radio span input[type='radio']").each(function(elemIndex, domElement) { //Each radio 
    if($(domElement).prop('checked')){
        radio = true;
    }
});

1 Comment

just tried same thing not working until i stop the page charge by cross on navigator ! its so weird everything work fine without that radio check

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.