jQuery is not loading properly when onclick event

225
January 07, 2018, at 9:23 PM

I want to implement, when clicked the label, should generate one multiple select element like in which many users are listed

<label class="control-label font_clr" onclick="DropDownTranformParticipantPerson('<?php  echo @$task_id ?>')">Participants :</label>

 function DropDownTranformParticipantPerson(){
    document.getElementById("participantLabel").remove();
    document.getElementById("participantParent").innerHTML='<select multiple="multiple" id="assigned_tos" name="assigned_to[]" style="width: 100%" class="select_multi"> <optgroup label="<?= lang('admin_staff') ?>"> <?php $query = $this->db->query("SELECT u.*, b.user_id, b.fullname,b.lastname FROM tbl_users u JOIN tbl_account_details b ON u.user_id = b.user_id where activated!='0' and u.role_id='3'|| u.role_id='1' order by b.fullname ASC");
        foreach ($query->result() as $row)
          {
            ?> <option value="<?php echo $row->user_id; ?>"><?php echo $row->fullname . ' '; ?><?php echo $row->lastname; ?></option><?php } ?></optgroup> </select>' ;
     isClickTaskParticipantAnyWhere=true;
 }

whenever I click on label it should generate one select (mulitple user can add) but it only works when i call DropDownTranformParticipantPerson function (without any click event ) example :

DropDownTranformParticipantPerson()// i call here
 function DropDownTranformParticipantPerson(){
    document.getElementById("participantLabel").remove();
    document.getElementById("participantParent").innerHTML='<select multiple="multiple" id="assigned_tos" name="assigned_to[]" style="width: 100%" class="select_multi"> <optgroup label="<?= lang('admin_staff') ?>"> <?php $query = $this->db->query("SELECT u.*, b.user_id, b.fullname,b.lastname FROM tbl_users u JOIN tbl_account_details b ON u.user_id = b.user_id where activated!='0' and u.role_id='3'|| u.role_id='1' order by b.fullname ASC");
        foreach ($query->result() as $row)
          {
            ?> <option value="<?php echo $row->user_id; ?>"><?php echo $row->fullname . ' '; ?><?php echo $row->lastname; ?></option><?php } ?></optgroup> </select>' ;
     isClickTaskParticipantAnyWhere=true;
 }

but any event occurd like in this it needs to be done on onclick event.

<label class="control-label font_clr" onclick="DropDownTranformParticipantPerson('<?php  echo @$task_id ?>')">Participants :</label>
function DropDownTranformParticipantPerson(){
        document.getElementById("participantLabel").remove();
        document.getElementById("participantParent").innerHTML='<select multiple="multiple" id="assigned_tos" name="assigned_to[]" style="width: 100%" class="select_multi"> <optgroup label="<?= lang('admin_staff') ?>"> <?php $query = $this->db->query("SELECT u.*, b.user_id, b.fullname,b.lastname FROM tbl_users u JOIN tbl_account_details b ON u.user_id = b.user_id where activated!='0' and u.role_id='3'|| u.role_id='1' order by b.fullname ASC");
            foreach ($query->result() as $row)
              {
                ?> <option value="<?php echo $row->user_id; ?>"><?php echo $row->fullname . ' '; ?><?php echo $row->lastname; ?></option><?php } ?></optgroup> </select>' ;
         isClickTaskParticipantAnyWhere=true;
     }

However some jQuery is missing while performing onclick event so that it is not working like previously

READ ALSO
How to make captcha check code to work

How to make captcha check code to work

When I click on my submit button I keep getting a blank message form, I believe that tell me that my JavaScript code is not passing to the registerphp?

233
Display gif on hover for resizable image map

Display gif on hover for resizable image map

I'm working on my personal website, and my concept is that the homepage is a responsive image map which is a photo of a surface of a deskThe items on the desk represent projects, and when you mouse over these objects, quick animated gifs show that interact...

218
jquery shorthand return variable undefined

jquery shorthand return variable undefined

so I have this variable that i retrieve from a parameter: var hash = getParameterByName('find')

211