wordpress-bootstrap icon indicating copy to clipboard operation
wordpress-bootstrap copied to clipboard

Uncaught TypeError

Open chadhenry opened this issue 12 years ago • 1 comments

I'm receiving this error in web inspector:

Uncaught TypeError: Property '$' of object [object Object] is not a function

in scripts.js line 10.

Any idea how to fix this?

chadhenry avatar Jun 13 '13 20:06 chadhenry

Try changing this:

function addTwitterBSClass(thisObj) {
  var title = $(thisObj).attr('title');
  if (title) {
    var titles = title.split(' ');
    if (titles[0]) {
      var num = parseInt(titles[0]);
      if (num > 0)
        $(thisObj).addClass('label');
      if (num == 2)
        $(thisObj).addClass('label label-info');
      if (num > 2 && num < 4)
        $(thisObj).addClass('label label-success');
      if (num >= 5 && num < 10)
        $(thisObj).addClass('label label-warning');
      if (num >=10)
        $(thisObj).addClass('label label-important');
    }
  }
  else
    $(thisObj).addClass('label');
  return true;
}

To this:

function addTwitterBSClass(thisObj) {
  var title = jQuery(thisObj).attr('title');
  if (title) {
    var titles = title.split(' ');
    if (titles[0]) {
      var num = parseInt(titles[0]);
      if (num > 0)
        jQuery(thisObj).addClass('label');
      if (num == 2)
        jQuery(thisObj).addClass('label label-info');
      if (num > 2 && num < 4)
        jQuery(thisObj).addClass('label label-success');
      if (num >= 5 && num < 10)
        jQuery(thisObj).addClass('label label-warning');
      if (num >=10)
        jQuery(thisObj).addClass('label label-important');
    }
  }
  else
    jQuery(thisObj).addClass('label');
  return true;
}

Does anyone else have input on this? Is there a better way to do this?

teamcrisis avatar Jun 14 '13 18:06 teamcrisis