samedi 3 décembre 2016

jQuery Get parameter value from URL and check radiobutton PHP

Hi i have a from with few radio buttons to filter my data...I want to check url to make a radio button checked...How i can achieve that ??

Form:

<form method="post">
<div>
    <input id="radio2" type="radio" name="scat" value="ABC" data-href="example.com?link=[value]">

    <label for="radio2">ABC</label>
</div>

</form>

Jquery:

$('input[type=radio]').click(function()
  {
     window.location=$(this).attr('data-href')
  });

Its working fine for me all i want is to check parameters values in url and check that radio button...

Thanks...




Aucun commentaire:

Enregistrer un commentaire