jQuery TypeError: example("input#autocomplete").autocomplete is not a function

Posted by Ankush Kalia on Stack Overflow See other posts from Stack Overflow or by Ankush Kalia
Published on 2012-10-01T15:36:28Z Indexed on 2012/10/01 15:37 UTC
Read the original article Hit count: 319

Filed under:
|
|
|
|

I have tried alot to remove this error but could not get success.When i am running this script on localhost its working fine but not working on Joomla frame work. The code is below:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<?php $viewFields=array('c++', 'java', 'php', 'coldfusion', 'javascript', 'asp', 'ruby'); ?>
  <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>

  <script>
  var example=jQuery.noConflict();
  var arrayFromPHP = <?php echo json_encode($viewFields) ?>;
  example(document).ready(function() {
   example("input#autocomplete").autocomplete({
    source: arrayFromPHP
});
  });
  </script>
</head>
<body>
<center>
<p><img src="<?php echo JURI::base(); ?>images/search_1.png" border="0" alt="" />
<img src="<?php echo JURI::base(); ?>images/business_2.png" border="0" alt="" />
<img src="<?php echo JURI::base(); ?>images/review_3.png" border="0" alt="" />
</p>
</center>
<input id="autocomplete" />
</body>
</html>

Its giving me this error:-

--

[08:30:24.870] Use of getAttributeNode() is deprecated. Use getAttribute() instead. @ http://50.116.97.120/~amarhost/storage/media/system/js/mootools-core.js:343
[08:30:27.853] TypeError: example("input#autocomplete").autocomplete is not a function @ http://50.116.97.120/~amarhost/storage/index.php/component/storage/?action=war&Itemid=105:210

© Stack Overflow or respective owner

Related posts about php

Related posts about JavaScript