mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
d9c7bb8eb9
The title attribute is extracted from form fields and displayed inline below the field.
26 lines
571 B
JavaScript
26 lines
571 B
JavaScript
(function($) {
|
|
$.entwine('ss', function($) {
|
|
/**
|
|
* Takes form fields with a title attribute, extracts it, and displays
|
|
* it as inline help text below the field.
|
|
*/
|
|
$(".cms form .field .middleColumn > [title]").entwine({
|
|
onmatch: function() {
|
|
var title = this.prop("title");
|
|
|
|
if(title && title.length) {
|
|
var span = $("<span></span>", {
|
|
"class": "help",
|
|
"text": title
|
|
});
|
|
|
|
this.closest(".field").append(span);
|
|
this.removeProp("title");
|
|
}
|
|
|
|
this._super();
|
|
}
|
|
});
|
|
});
|
|
}(jQuery));
|