jQuery: how to split string?

See more articles in PHP category

There are many chances to split string with delimiter .
jQuery has a function which is very similar to PHP explode.

<span class="example">Oct 30, 2011 to Nov 05, 2011</span>


 If you just want to take 'Oct 30', you can use this jQuery syntax.

$(".example").val().split(",")[0];

 
This will print out

Oct 30

 

 
저작자 표시 비영리 변경 금지