Hello.
Help to understand, have a day without sleep will soon go crazy.
There is a script that hides part of the number
jQuery(document).ready(function($){ $.fn.textToggle = function(cls, str) { return this.each(function(i) { $(this).click(function() { var c = 0, el = $(cls).eq(i), arr = [str,el.text()]; return function() { el.text(arr[c++ % arr.length]); }}()); })}; $(function(){ $('.nomer_shapka').textToggle(".nomer_shapka",").click(); $('.nomer_shapka').textToggle(".num_hide","XX-XX").click(); }); });
A to it HTML code
(999)999-99-99show
The essence of simple code - hiding the last 4 digits of the phone number instead - XX-XX. Clicking on the SHOW button, they appear and the show button disappears. + The goal is sent to Google.
If this objective with the onclick event to hang on any other element of the website all OK, activated at the touch, but in this code the purpose of is triggered itself immediately after page load.
Tell me where I went wrong or what to add to make it work correctly.