javascript - jQuery dynamic Right-to-Left CSS processing -


i have list might this:

<ul>  <li>table</li>  <!-- english -->  <li>मेज</li>    <!-- hindi -->  <li>میز</li>   <!-- urdu --> </ul> 

i want use jquery read characters in list-item , if finds characters in arabic unicode range (0x0600 - 0x06ff), underline it.

here have:

$("li:contains(/[\u0600-\u06ff]/)").css( "text-decoration", "underline" ); 

it should match third item i'm doing wrong. perhaps regular expressions not allowed :contains in jquery selectors...

you can use filter() regexp.
try following:

var regex = new regexp(/[\u0600-\u06ff]/);  $("li").filter(function() {     return regex.test($(this).text()); }).css("text-decoration", "underline"); 

Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -