Sunday, 15 July 2012

javascript - How to make jQuery filter(':contains("XXX")') Case insensitive? -



javascript - How to make jQuery filter(':contains("XXX")') Case insensitive? -

this question has reply here:

is there case insensitive jquery :contains selector? 9 answers

i using jquery 1.7.1. need create filter(':contains("xxx")') selector case insensitive. have tried this , this no luck means not working. precise, $('div:contains') works filter(':contain') not

use regular look , filter function :

yourjqueryset.filter(function(){ homecoming $(this).text().match(/xxx/i) })

if string xxx dynamically provided, use

var r = new regexp(str, 'i'); var outputset = inputset.filter(function(){ homecoming $(this).text().match(r) })

javascript jquery

No comments:

Post a Comment