jeudi 28 janvier 2016

jquery change first part of input value with dropdown value

My html:

<table>
    <tr>
        <td>
          <input type="checkbox" name="checkbox[]" value="Volvo,4 wheels, hardtop"/>
        </td>
        <td>
            <select>
                <option value="volvo">Volvo</option>
                <option value="saab">Saab</option>
                <option value="opel">Opel</option>
                <option value="audi">Audi</option>
            </select>
        </td>
    </tr>
    <tr>
        <td>
          <input type="checkbox" name="checkbox[]" value="Volvo,4 wheels, hardtop"/>
        </td>
        <td>
            <select>
                <option value="volvo">Volvo</option>
                <option value="saab">Saab</option>
                <option value="opel">Opel</option>
                <option value="audi">Audi</option>
            </select>
        </td>
    </tr>
</table>

I want the first word of the value in the checkbox to be the same as the word selected in the dropdown. But only in the same row. So if the value in the dropdown of the first row is 'Saab', the value in the second row shouldn't be automatically 'Saab' but could be a different value. How can i do this?




Aucun commentaire:

Enregistrer un commentaire