diff options
-rw-r--r-- | src/usr/local/www/diag_edit.php | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/usr/local/www/diag_edit.php b/src/usr/local/www/diag_edit.php index 595be43..9047222 100644 --- a/src/usr/local/www/diag_edit.php +++ b/src/usr/local/www/diag_edit.php @@ -193,9 +193,22 @@ print_callout(gettext("The capabilities offered here can be dangerous. No suppor $("#btngoto").prop('type','button'); + //On clicking the GoTo button, validate the entered value + // and highlight the required line $('#btngoto').click(function() { var tarea = document.getElementById("fileContent"); - showLine(tarea, $('#gotoline').val()); + var gtl = $('#gotoline').val(); + var lines = $("#fileContent").val().split(/\r|\r\n|\n/).length; + + if (gtl < 1) { + gtl = 1; + } + + if (gtl > lines) { + gtl = lines; + } + + showLine(tarea, gtl); }); }); |