I have this return:
return ‘<input ‘.( ( isset( $hole_number ) && isset( $current_player_par_value ) ) ? ‘title=”#’ . $hole_number . ‘,par= ‘.$current_player_par_value.'”‘ : ” ).’ type=”text” value=”‘.$value.'” name=”row_’.$row[‘id’].’‘.$result_type.'” ‘.$disabled.’ id=”row‘.$row[‘id’].’_’.$result_type.'” style=”width:20px;” maxlength=”2″ /><a ‘.$onclick.’ href=”javascript:;” rel=”‘.create_url( ‘user’, ‘user_event_golf/set_penalty_for_participant’, array( ‘eventFK’ => $row[ ‘eventFK’ ], ‘scope_typeFK’ => $scope_typeFK, ‘objectFK’ => $row[‘id’], ‘scope_data_type’ => $number[ ‘number’ ] ) ).'” target=”_blank” “> ‘.( $penalty_value == ” ? ‘P’ : $penalty_value ).’ ‘.( $hole_number_value == ” ? ‘#’ : $hole_number_value ).'</a><font color=”red”>’.( $clock_penalty_value == ” ? ” : $clock_penalty_value ).'</font>’;
The button name is P https://snipboard.io/VSgQ6D.jpg
And i want to give some user alert msg when the button is clicked. Please help me guys i’m so lost here… I tryed to implement something like that https://www.w3schools.com/jquery/tryit.asp?filename=tryjquery_event_click but just couldn’t write the syntax right
I basically have $lock variable and i want to check if $lock== true if its true to open the link if not the alert to appear
https://api.jquery.com/click/
If you have syntax errors you should show us the resulting javascript code.
I managed to do it, but its working only for the first button “P” and then the msg go in loop
https://snipboard.io/wo9e16.jpg
Do you have any idea why?
return ‘<input ‘.(( isset( $hole_number ) && isset( $current_player_par_value ) ) ? ‘title=”#’ . $hole_number . ‘,par= ‘.$current_player_par_value.'”‘ : ” ).’ type=”text” value=”‘.$value.'” name=”row_’.$row[‘id’].’_’.$result_type.'” ‘.$disabled.’ id=”row_’.$row[‘id’].’_’.$result_type.'” style=”width:20px;” maxlength=”2″ /> <a id=”moo”>P</a> <script>document.getElementById(“moo”).addEventListener(“click”, function() {alert(“Error message”);});</script> <font color=”red”>’.( $clock_penalty_value == ” ? ” : $clock_penalty_value ).'</font>’;
Members
Online