Home > Software design >  Checked Check Progress
Checked Check Progress

Time:09-01

Here

As you can see above, I have the data I pulled from the database and these are the radio inputs.

Each one has unique database ids and I want to check here with jquery.

For example, if the phone does not select one of the 16GB or 32GB options, I want to give a warning. Since the data coming here comes with a loop, the same thing will enter the loop.

If it is selected, I want to get the values in it.

I would be glad if you could help me.

<form action="" type="POST" onsubmit="return false;">
  <div id="form_step_1">
    <div >
      <div >
        <div >
          <H4>GB</H4>
          <div  style="display: inline-block">
            <div >
              <input  type="radio" id="1" name="1">
              <label  style="display: inline-block;">16 GB</label>
              <input  type="radio" id="2" name="1">
              <label  style="display: inline-block;">32 GB</label>
            </div>
          </div>
          <H4>DİSPLAY</H4>
          <div  style="display: inline-block">
            <div >
              <input  type="radio" id="3" name="2">
              <label  style="display: inline-block;">durable</label>
              <input  type="radio" id="4" name="2">
              <label  style="display: inline-block;">broken</label>
            </div>
          </div>
        </div>
        <button type="submit"  id="gonder">Gönder</button>
      </div>
    </div>
  </div>
</form>

CodePudding user response:

i will make it simple for you !

add a class to the inputs for exemple : storage or space

preview :

<div  style="display: inline-block">
        <div >
          <input  type="radio" id="1" name="1">
          <label  style="display: inline-block;">16 GB</label>
          <input  type="radio" id="2" name="1">
          <label  style="display: inline-block;">32 GB</label>
        </div>
      </div>

and then by jquery you can detect selected one:

$('.storage').on('change',function(){
    let selected  = $('.storage:checked');
    console.log(selected.val());
})

and for other inputs the same process

add new class to them exemple : phone-status or somthing else

and keep going

  • Related