Note that there are some explanatory texts on larger screens.

plurals
  1. POgetting error in in firebug as jQuery(..).autocomplete is not function?
    text
    copied!<p>HI I have the following code in which I have used jquery for autocomplete functionality.</p> <pre><code> &lt;div class="row"&gt; &lt;p class="hint"&gt;&lt;?php echo bfstring('tooltip_billing_state_zip'); ?&gt;&lt;/p&gt; &lt;label&gt;State&lt;span&gt;*&lt;/span&gt;&lt;/label&gt; &lt;div&gt; &lt;select name="jc_state" class="required"&gt;&lt;/select&gt; &lt;/div&gt; &lt;div class="cl"&gt;&amp;nbsp;&lt;/div&gt; &lt;em class="status"&gt;&lt;/em&gt; &lt;/div&gt; &lt;div class="row"&gt; &lt;p class="hint"&gt;&lt;?php echo bfstring('tooltip_billing_state_zip'); ?&gt;&lt;/p&gt; &lt;label&gt;ZIP/Postal Code &lt;span&gt;*&lt;/span&gt;&lt;/label&gt; &lt;input type="text" class="field required blink" value="Zip Code" title="Zip Code" name="jc_zip" id="jc_zip"/&gt; &lt;div class="cl"&gt;&amp;nbsp;&lt;/div&gt; &lt;em class="status"&gt;&lt;/em&gt; &lt;/div&gt; &lt;div class="row"&gt; &lt;p class="hint"&gt;&lt;?php echo bfstring('tooltip_billing_country'); ?&gt;&lt;/p&gt; &lt;label&gt;Country &lt;span&gt;*&lt;/span&gt;&lt;/label&gt; &lt;select name="jc_country" class="required"&gt; &lt;option value=""&gt;Please Select&lt;/option&gt; &lt;?php foreach ($countries as $cid =&gt; $c) : ?&gt; &lt;option &lt;?php echo ($cid == '840') ? 'selected="selected"' : ''; ?&gt; value="&lt;?php echo $cid; ?&gt;"&gt;&lt;?php echo $c['name']; ?&gt;&lt;/option&gt; &lt;?php endforeach; ?&gt; &lt;/select&gt; &lt;div class="cl"&gt;&amp;nbsp;&lt;/div&gt; &lt;em class="status"&gt;&lt;/em&gt; &lt;/div&gt; &lt;/div&gt; &lt;script type="text/javascript"&gt; zipAutoComplete112('jc'); function zipAutoComplete112(prefix){ alert(1); jQuery( "#"+prefix+"_zip" ).autocomplete({ source: function( request, response ) { jQuery.ajax({ url: "http://ws.geonames.org/postalCodeSearchJSON", dataType: "jsonp", data: { style: "full", maxRows: 12, postalcode_startsWith: request.term }, success: function( data ) { alert(3); response( jQuery.map( data.postalCodes, function( item ) { return { label: item.placeName + (item.adminCode1 ? ", " + item.adminCode1 : "") + ", " + item.postalCode + ", "+item.countryCode, value: item.postalCode } })); jQuery('.ui-autocomplete').css('width', '188px'); } }); }, minLength: 2, select: function( event, ui ) { var myString= new String(ui.item.label); var address = myString.split(',') jQuery('#'+prefix+'_city').val(address[0]); jQuery('#'+prefix+'_city').addClass('activated'); jQuery('#'+prefix+'_city').trigger('change'); jQuery('#'+prefix+'_city').parents('.row').addClass('ok-row') var countryCode = address[3] ? address[3]: address[2] countryCode = jQuery.trim(countryCode); var countryName = jQuery('#'+prefix+'_country option[value="'+jQuery.trim(countryCode)+'"]').text() jQuery('#countryContainer .jqTransformSelectWrapper span').html(countryName) jQuery('#countryContainer .jqTransformSelectWrapper').addClass('selected-jqtranform'); jQuery('#'+prefix+'_country').parents('.row').addClass('ok-row') jQuery('#'+prefix+'_country').val(jQuery.trim(countryCode)) var stateCode = address[2] ? address[1]: ''; stateCode = jQuery.trim(stateCode) if(countryCode == 'US'){ jQuery.ajax({ url: base_url+"/getStateName", dataType: "jsonp", data: { stateCode: stateCode }, success: function( data ) { stateName = data jQuery('#'+prefix+'_state').val(stateName); jQuery('#'+prefix+'_state').addClass('activated'); jQuery('#'+prefix+'_state').parents('.row').addClass('ok-row') jQuery('#'+prefix+'_state').trigger('change'); formValidate(); } }); }else{ stateName = stateCode jQuery('#'+prefix+'_state').val(stateName); jQuery('#'+prefix+'_state').addClass('activated'); jQuery('#'+prefix+'_state').parents('.row').addClass('ok-row') jQuery('#'+prefix+'_state').trigger('change'); formValidate(); } jQuery('#'+prefix+'_zip').parents('.row').addClass('ok-row') jQuery('#'+prefix+'_zip').parents('.row').removeClass('error-row'); }, open: function() { jQuery( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" ); }, close: function() { jQuery( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" ); } }); } &lt;/script&gt; </code></pre> <p>When I run this code I get a error in firebug as jQuery(..).autocomplete is not function. I dont know where I am going wrong.Please help me. Thanks In advance.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload