cannot insert special character in input type element.
cannot insert special character in input type element.
petitsinge
Posts: 11Questions: 1Answers: 0
This bug has been baffling me for couple of hours now.
I insert data dynamically from a jquery function that looks likes the example below.
http://live.datatables.net/Amec/4/edit?html,css,js,output
It actually takes tab separated values that are inserted into a text area.
My problem is that when there is special character like ' or " it will trunk the textbox value.
Like the values in Column 2 of the example.
I tried double escaping and even then as soon as it sees the ' character it removes the rest of the text.
Is there a way to insert the whole value without regard for for single or double-quotes?
Thanks
Yan
I insert data dynamically from a jquery function that looks likes the example below.
http://live.datatables.net/Amec/4/edit?html,css,js,output
It actually takes tab separated values that are inserted into a text area.
My problem is that when there is special character like ' or " it will trunk the textbox value.
Like the values in Column 2 of the example.
I tried double escaping and even then as soon as it sees the ' character it removes the rest of the text.
Is there a way to insert the whole value without regard for for single or double-quotes?
Thanks
Yan
This discussion has been closed.
Replies
[code]
function escapeHtml(unsafe) {
return unsafe
.replace(/&(?!amp;)/g, "&")
.replace(/<(?!lt;)/g, "<")
.replace(/>(?!gt;)/g, ">")
.replace(/"(?!quot;)/g, """)
.replace(/'(?!#039;)/g, "'");
}
[/code]