I have an error calling a popap using Jquery:
1. HTML Code Button
<button type="button" class="btn btn-primary" id="btnAddCentrocosto" value="AddCentrocosto" onclick="$parent.openAddCentrocosto">Agregar Centro Costos</button>
2. Popap HTML
<div class="panel-heading" id="dialogAddCentrocosto" title="Centro de Costos...">
<table>
<tr>
<td><label>Costo : </label></td>
<td><input type="text" id="nCosto" /></td>
</tr>
<tr>
<td><label>Observaciones : </label></td>
<td><textarea rows="5" id="strObservacionDistribucion" class="form-control" name="strObservacionDistribucion"></textarea></td>
</tr>
</table>
</div>
3. Jquery
self.openAddCentrocosto = function () {
tr = jQuery('#btnAddCentrocosto').parent().parent();
jQuery('#Distribucion').val(jQuery('td[data-bind="text: Distribucion"]', tr).text());
jQuery('#nCosto').val('');
jQuery('#nImpuestoDistribucion').val('18');
//jQuery('#nTotalDistribucion').val('');
jQuery('#dialogAddCentrocosto').dialog('open');
}
4. Error message When clicking on the button I should raise the popap, but it is not done and it shows me the following error message:
Uncaught ReferenceError: $parent is not defined
at HTMLButtonElement.onclick
Please, if someone can help me with this error, thank you very much.