Question

In my db I'm storing something like this:

<p>something</p>

and then i'm loading that value into a markitup editor, but it keeps showing up like this

&lt;p&gt;something&lt;/p&gt;

How can I make it so it shows <p>something</p> in the markitupeditor?

Settings:

// used for the markitup editor
     mySettings = {
        nameSpace:      'html',
        onShiftEnter:   {keepDefault:false, replaceWith:'<br />\n'},
        onCtrlEnter:    {keepDefault:false, openWith:'\n<p>', closeWith:'</p>'},
        onTab:          {keepDefault:false, replaceWith:'    '},
        markupSet:  [   
            {name:'Heading 2', key:'2', openWith:'<h2(!( class="[![Class]!]")!)>', closeWith:'</h2>', placeHolder:'Your title here...' },
            {name:'Paragraph', openWith:'<p(!( class="[![Class]!]")!)>', closeWith:'</p>'  },
            {name:'Bold', key:'B', openWith:'(!(<strong>|!|<b>)!)', closeWith:'(!(</strong>|!|</b>)!)' },
            {name:'Italic', key:'I', openWith:'(!(<em>|!|<i>)!)', closeWith:'(!(</em>|!|</i>)!)'  },
            {name:'Stroke through', key:'S', openWith:'<del>', closeWith:'</del>' },
            {separator:'---------------' },
            {name:'Bulleted List', openWith:'    <li>', closeWith:'</li>', multiline:true, openBlockWith:'<ul>\n', closeBlockWith:'\n</ul>'},
            {name:'Numeric List', openWith:'    <li>', closeWith:'</li>', multiline:true, openBlockWith:'<ol>\n', closeBlockWith:'\n</ol>'},
            {separator:'---------------' },
            {name:'Picture', key:'P', replaceWith:'<img src="[![Source:!:http://]!]" alt="[![Alternative text]!]" />' },
            {name:'Link', key:'L', openWith:'<a href="[![Link:!:http://]!]"(!( title="[![Title]!]")!)>', closeWith:'</a>', placeHolder:'Your text to link...' },
            {separator:'---------------' },
            {name:'Clean', className:'clean', replaceWith:function(markitup) { return markitup.selection.replace(/<(.*?)>/g, "") } },       
            {name:'Preview', className:'preview',  call:'preview'}
        ]
     }
Was it helpful?

Solution

The reason that my html tags were being converted to special chars was because of a parameter I had set on my the codeigniter form_textarea function.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top