javascript - How to set a value of hyperlink text from a hyperlink to a hidden field on a jQuery dialog pop-up when user clicks on that hyperlink? -


i'm using php, smarty, jquery(jquery-1.7.1.min.js), javascript, ajax, etc. in website. there multiple hyperlinks containing different question ids present on webpage. instance i'm showing html code 1 hyperlink follows:

<a class="que_issue" href="#">que38552</a> <!--there many other hyperlinks present on same page different question ids.--> 

now i've html code dialog pop-up on same web page set style="display:none;" in div when page loads. done hide dialog box when page loads. when user clicks on of hyperlinks dialog pop-up appears. script functionality working fine. html of dialog pop-up follows:

<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> 

now issue i'm not able set value of question id clicked hidden field(having id="question_id") on dialog pop-up. tried following script doing didn't worked. following javascript code tried:

$(document).on("click","a[class='que_issue']", function (e) { var x = this.innerhtml;   var str = x.substring(3); document.getelementbyid("question_id").value = str; }); 

following jquery code tried:

$('.que_issue').click(function(e){  e.preventdefault();  $('#question_id').val($.trim($(this).text()).substring(3)); }); 

both of above code didn't wor me. when removed line style="display:none;" dialog pop-up's div dialog pop-up displays @ bottom of page , when click on specific question id, question id gets set hidden field @ form appearing @ bottom of page. still hidden field on dialog pop-up value didn't set. i'm totally clue-less after trying every possible thing , googling. can please me in regard please? thank spending of valuable time , understanding issue. once again. if want more information regarding issue can provide same.

pass id in var before setting it.


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -