Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 138163

How to change ANY text when click on it? jQuery

$
0
0

I want any text on the site to change to 'Ok!' when I click on it.

enter image description hereenter image description here

I tried using this code:

if($('*').text() != ''){
    $(this).click(function(){
        $(this).text('Ok!');
    });
}

But it does not work because if the text is in a div it changes when I click anywhere in div, but I need that only when I click on the text.


Viewing all articles
Browse latest Browse all 138163

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>