Hi Thanks for anyone who can help me with this. I want jquery to do something if a particular hash tag is present (eg #hello) and then do something. if (present #hello) {do this} else {do this} Is this possible?
Try this, let me know if it helps. hashtag_regexp = [COLOR=#800000]/#([a-zA-Z0-9]+)/[/COLOR]g; [COLOR=#00008B]function[/COLOR] linkHashtags(text) { [COLOR=#00008B]return[/COLOR] text.replace( hashtag_regexp, [COLOR=#800000]'<a class="hashtag" href="http://twitter.com/#search?q=$1">#$1</a>'[/COLOR] ); } $(document).ready([COLOR=#00008B]function[/COLOR](){ $([COLOR=#800000]'p'[/COLOR]).each([COLOR=#00008B]function[/COLOR]() { $([COLOR=#00008B]this[/COLOR]).html(linkHashtags($([COLOR=#00008B]this[/COLOR]).html())); }); }); Code (markup): With above code the text containing the hash tag must be within <p></p>