jeudi 12 novembre 2015

Using jQuery to check a checkbox based on text values from other div

i am a beginner developer, and i want to check a checkbox based on the values from other div.

For example, i want the checkbox to be checked if this page got a text name "title". If it doesn't have a "title" then the checkbox won't be checked.

<div class="testdiv">
<p>title</p>
</div>

<div class="checkbox">
<input type="checkbox" name="testcheck" id="testcheck" value="1">
<label for="testcheck">Lorem Ipsum</label>
</div>




Aucun commentaire:

Enregistrer un commentaire