Split the string based on
tag using jquery

前端 未结 10 948
温柔的废话
温柔的废话 2021-01-17 20:04

How can i split the string containing
tag using jquery. I tried the following code but it get error in console. I am not sure how to split the strin

10条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-17 20:43

    You want to split a vanilla string, don't pass it to $() rather simply;

    jQuery(document).ready(function($)
        {
            var lines = 'this is for testing 
    How are you
    '.split('
    '); jQuery.each(lines, function() { alert(this); }); });

提交回复
热议问题