所以我在这里想要完成的是改变受一些正则表达式影响的单词的颜色。
$(document).ready(function(){
container = $("#modal_container section").text();
hashtags = /\#\w+/g;
var container_hash = container.match(hashtags);
$(container_hash).css({'color':'red'});
//We're grabbing the words, but how can I change the color?
alert(container_hash);
});
这是一个小提琴http://jsfiddle.net/vuDzC/2/让它更清楚。
谢谢