javascript - Finding the first sentence with jQuery -
I'm trying to find the first sentence of a textarea. Right now, I can find the full stop before and can convert it to an array with .split () , but what happens if they use exclamation marks, question marks, etc. ?
I have the following:
var l = $ ('p'); $ ('Texture') keyboard (function () {var t = $ ('textarea'). Val (); var t = t.split ('.'); L.text (t [0]);}) ; Is there any way to make it more fully, so it is divided into any form:
. , . , ! , ? , enter / linebreak
Any help would be great,
Yes there is a way.
Do this:
var t = t.split (/ [\ ?! \. \ n \ r \] /); I am using regex , in which I am using the character square to define how to split.
Comments
html css कोड वेबमास्टर्स के लिए उदाहरण हैं
ReplyDeleteसूची शैली छवि सूची शैली स्थिति कोड उदाहरण