I am trying to select a dynamic variable from a checkbox to disable or enable depending upon that state of the checkbox.
HTML Code:

```
<input type="checkbox" name="only_once_1" id="only_once_1" class="onlyonce" >
<input type="text" id="temp_1" name="temp_1">

```

JAVASCRIPT

```
$(".onlyonce").change(function($){
   var parts = this.name.match(/(\D+)(\d+)$/); 
   if(this.value == "on"){
      $("#"+"temp_"+parts[2]).disable()
   }else{
      $("#"+"temp_"+parts[2]).enable()
   }
});

```

The idea is that I may have many copies of these boxes that are added dynamically. Any ideas how to get this to work?

Thanks!