jeudi 18 juillet 2019

Get value checkbox with the same class

I need to get values from checkboxes with the same class and different values, to get these values when activate submit bottom and select the different checkbox

<script>
  jQuery(.simple_search).click(function(){
    if (jQuery('.skey_send').is(":checked")){
     var s_key=jQuery(".skey_send").val();
     alert("Value is : "+s_key);
    } 
  });
</script>


<input type="submit" class="simple_search" name="send_s" value="GO" />

<input type="radio" name="s_key" class="skey_send" value="all" />All
<input type="radio" name="s_key" class="skey_send" value="card" />Card
<input type="radio" name="s_key" class="skey_send" value="phone" />Phone
<input type="radio" name="s_key" class="skey_send" value="price" />Price

The Problem´s always I get value from the first checkbox but no when clicking over another or different checkbox

I need to know what I need implement or add in my code for getting value from different checkboxes with the same class when checking




Aucun commentaire:

Enregistrer un commentaire