javascript - How to use create event on a jQuery dialog in following scenario? -


i've have following dialog pop-up html hidden when page loads(look line style="display:none;" in div):

<div id="searchpopcontent" class="c-popup" style="display:none;">       <div id="pop-up">       <div class="error_msg" id="report_error" style="text-align:center; margin-top:5px;">          </div>         <div class="clear"></div>         <form name="question_issue_form" id="question_issue_form" class="login_box" method="post" action="question_issue.php">           <input type="hidden" name="form_submitted" id="form_submitted" value="yes"/>           <input type="hidden" name="post_url" id="post_url" value="question_issue.php"/>           <input type="hidden" name="op" id="op" value="question_issue"/>           <input type="hidden" name="question_id" id="question_id"/>            <table class="trnsction_details" width="100%" cellpadding="5">             <tbody>                   <tr>                 <td></td>                 <td>                   <input type="checkbox" name = "que_issue[]" value = "question wrong" id ="chkquewrong">question wrong</input>                 </td>               </tr>               <tr>                 <td></td>                 <td><input type="checkbox" name = "que_issue[]" value = "answers wrong" id ="chkanswrong">answers wrong</input></td>                </tr>               <tr>                 <td></td>                 <td><input type="checkbox" name = "que_issue[]" value = "question direction incorrect" id ="chkdirincorrect">question direction incorrecct</input></td>                            </tr>               <tr>                 <td></td>                 <td><input type="checkbox" name = "que_issue[]" value = "other" id ="chkother">other</input></td>                         </tr>               <tr>                 <td></td>                 <td class="set_message" style="display:none;"><textarea name="que_issue_comment" id = "que_issue_comment" rows="4" cols="25" maxlength="100"></textarea></td>                     </tr>               <tr>                 <td></td>                 <td><input type="submit" name="submit" value="submit" class="report_question_issue" class="buttonin"/></td>               </tr>             </tbody>           </table>         </form>       </div>     </div> 

i want dynamically set value of input type hidden having id="question_id". after doing research came know have use create() method of jquery ui dialog plugin set hidden field value in ui dialog dynamically. tried call create() event in jquery dialog call couldn't able set value. can please me in regard please? following code tried use create() event.

$(document).on("click","a[class='que_issue']", function (e) { var hypertext = this.innerhtml;   var que_id = hypertext.substring(3);    //document.getelementbyid("question_id").value = que_id;   //$("#question_id").val(str);      var data = $('#searchpopcontent').html();      var title = "question issue";     var dialog_title   = title;      var dialog_message = data;              var $dialog = $("<div class='view_result'></div>")      .html(dialog_message)      .dialog({            autoopen: false,            modal:true,            title: dialog_title,            width: 400,                                 close:{            },            create: function() {        $("#question_id").val(que_id);     }      });      $dialog.dialog('open');      return false; }); 

also there no errror in firebug console above code.

i modified js: http://jsfiddle.net/jyplc/1/ , works.

$(document).ready(function(){         $("#searchpopcontent").dialog({        autoopen: false,        modal:true,        title: "question issue",        width: 400,         close:{        }         }); });  $("a.que_issue").on("click", function (e) {     var hypertext = this.innerhtml;     var que_id = hypertext.substring(3);     var title = "question issue";      $("#question_id").val(que_id);     $("#qns_id").val(que_id); //this show works, can delete     $("#searchpopcontent").dialog('open');      return false; }); 

you should modify html first, call dialog() show popup.


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

angularjs - ng-repeat duplicating items after page reload -