html5 - Adding placholder attribute to Magento CMS page -
i having trouble add placeholder attribute input elements in cms page of magento. this:
<input type="text" placeholder="hello" />
i proceed save cms page, however, seems me magento overrides placeholder attribute, preventing placeholders seen in html being displayed.
is there way achieve this?
this one's little tricky. if check cms_page
database table, you'll find magento saving html tag placeholder
attribute. also, if view page via frontend , not admin interface, you'll find magento renders placeholder attribute.
the problem is, magento's tinymce editor configured strip out invalid input
attributes, , list hasn't been updated reflect changes in html5.
if you're using reasonably modern version of magento, can fix inserting following javascript admin page after tinymce javascript loaded, before magento runs inline wysiwygpage_content = new tinymcewysiwygsetup...
javascript. warning: threw together, may not work in browsers. buyer beware, test, etc.
if(tinymcewysiwygsetup) { tinymcewysiwygsetup.prototype.originalgetsettings = tinymcewysiwygsetup.prototype.getsettings; tinymcewysiwygsetup.prototype.getsettings = function(mode) { var settings = this.originalgetsettings(mode); settings.extended_valid_elements = 'input[placeholder|accept|alt|checked|disabled|maxlength|name|readonly|size|src|type|value]'; return settings; } }
update: have new module provides easy mechanism adding these sorts of tinymce settings magento's editor.
Comments
Post a Comment