2016-04-09 15 views
0
$('#modalSetDonationsProducts').on('show.bs.modal', function (e) { 
    alert("dljasld"); 
    rowNumber = 1; 
    $('#tblEmployees tbody tr').remove("tr:gt(0)"); 
    alert("enterd"); 
    var itemname = $(this).parent().parent().find(rowData["ItemName"]).val() 
    alert(itemname);    
    $(e.currentTarget).find('input[name="item"]').val(itemName); 
    $(e.currentTarget).find('input[name="description"]').val(itemName); 
    $(e.currentTarget).find('input[name="item"]').enabled = false;  
}); 

Ich habe diese Funktion und modalmodal kann seine Show nicht Funktion zugreifen

<div class="modal modal-flex " id="modalSetDonationsProducts"> 
    <div class="modal-dialog" style="min-width: 900px; max-width:1000px;width:auto"> 
     <div class="modal-content"> 
      <div class="modal-header" style="width:100%;"> 
       <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span> <span class="sr-only">Close</span></button> 
       <h4 class="modal-title">&nbsp;<%= GetLocalResourceObject("addnewitem")%></h4> 
      </div> 
      <div class="modal-body"> 
       <p><%= GetLocalResourceObject("addnewitem")%></p> 

       <div class="table-responsive"> 
        <table class="table" id="tblEmployees"> 
         <thead> 
          <tr> 
           <th>#</th> 
           <th></th> 
          </tr> 
         </thead> 
         <tbody> 
          <tr id="rowID1"> 
           <td>1</td>          
           <td> 
            <input type="text" style="min-width:230px" readonly="readonly" name="item" value="" /></td> </tr> 

         </tbody> 
        </table> 
       </div> </div> 
      <div class="modal-footer"> 
       <button type="button" class="btn btn-default" data-dismiss="modal"></button> 
       <button type="button" onclick="SaveProducts();" class="btn btn-green ladda-button">       
       </button>      
      </div> 
     </div> 
    </div> 
</div> 

ich modal nennen dieses

<a data-toggle=\"modal\" href=\"#modalSetDonationsProducts\" class=\"btn btn-green\" name=\"btnSplit\">add</a> 

Was bereits geschehen ist:

 
1. model open Correctly .  

2. it can't access the $('#modalSetDonationsProducts').on('show.bs.modal', function (e) and show the first alert at least . 

3. my modal call by button from another table and I just want to set the input name="item" by parent.find way. 

+0

wie es scheint, haben Sie verpasst haben, ',' Semikolon ('alert (" dljasld ")'), aufgrund dessen es weiter zur Ausführung Ihres onShowOfModal-Ereignisses vorgeht. – ameenulla0007

+0

Ich denke, es hat keine Wirkung, oder meinst du anderen –

+0

Sie sollten Titel und href nicht entkommen, wenn das ist, wie Ihr HTML aussieht. –

Antwort

0

Arbeits Fiddle: https://jsfiddle.net/3rfb4vny/

ich denke, Sie gehen falsch mit dem Targeting-Elemente, ich habe Ihre HTML und JS Ereignis versucht

$('#modalSetDonationsProducts').on('show.bs.modal', function (e) { 
    alert("displaying"); 
}); 
+0

'' Add ich von diesem Tag Modal nenne, gibt es eine Ankündigung @ ameenulla0007 –

+0

Yup sicher, Sie den Tag verwenden können, aber? Slashes aus dem Tag entfernen. – ameenulla0007

+0

Ich nenne dieses Tag dynamisch in Jquery, also kann ich diese Schrägstriche nicht entfernen –

Verwandte Themen