Skip to content
Snippets Groups Projects
Commit edb345b9 authored by falcon's avatar falcon
Browse files

#832268 reported by igorik: Fixed: autotitle now strips away html tags as you type

parent 90ef84e3
No related branches found
No related tags found
No related merge requests found
......@@ -2273,12 +2273,16 @@ function quiz_set_auto_title() {
$max_length = variable_get('quiz_autotitle_length', 50);
drupal_add_js('
$(document).ready(function () {
function quizStripTags(str) {
return str.replace(/<\/?[^>]+>/gi, \'\');
}
function quizUpdateTitle() {
if ($("#edit-body").val().length > '. $max_length .') {
$("#edit-title").val($("#edit-body").val().substring(0, '. $max_length .' - 3) + "...");
if (quizStripTags($("#edit-body").val()).length > '. $max_length .') {
$("#edit-title").val(quizStripTags($("#edit-body").val()).substring(0, '. $max_length .' - 3) + "...");
}
else {
$("#edit-title").val($("#edit-body").val().substring(0, '. $max_length .'));
$("#edit-title").val(quizStripTags($("#edit-body").val()).substring(0, '. $max_length .'));
}
}
$("#edit-body").keyup(quizUpdateTitle);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment