javascript - Populate input field based on checkbox id values -


i have input field defined this:

<form class="form-inline">     <input type="text" title= "language" class="input-block-level" placeholder="insert languages"/> </form> 

i wrote mock jquery script put word "yes" based on whether checkbox has been checked. here:

$(document).ready(function () {      $('#checkbox').change(function(){         if ($('#checkbox').is(':checked')) {              $("input[title='language']").val("yes");          }     });  });  

however, it's not working , there no errors in console. i'm new jquery , having hard time understanding put it, , how $(document).ready(function () { functions, may problem.

the non-working example can seen here http://dreaminginswahili.com/admin/mapv4.html on languages pane.

$('#checkbox') looks element id="checkbox", this

<input type="text" id="checkbox" /> 

but don't have in html, nothing happens.

if have checkbox elements <input type="checkbox" />, can select checkboxes this:

$(':checkbox') 

and can select "checked" boxes this:

$(':checkbox:checked') 

Comments

Popular posts from this blog

javascript - JS causing window size to be bigger than necessary - Dropdown bug -

How to mention the localhost in android -

php - Calling a template part from a post -