jquery - 0x800a01b6 - JavaScript runtime error: Object doesn't support property or method 'SumoSelect' -


i'm getting above error message when trying call sumoselect function against select option element on aspx page.

i have following references in web page:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js" type="text/javascript"></script> <script src="jquery.sumoselect.js"  type="text/javascript"></script> <link href="sumoselect.css" rel="stylesheet" /> 

with files taken from: https://github.com/hemantnegi/jquery.sumoselect/zipball/master

at present have included following in project download:

  1. jquery.sumoselect.js

  2. sumoselect.css

my jquery correctly locating 1 of element with:

<script type="text/javascript"> $(document).ready(function () {    var elements = document.getelementsbytagname("*");    (i = 0; < elements.length; i++) {     element = elements[i];     name = element.id;      if (name.match(/fieldid_3/)) {       $(element).sumoselect();     }   } }); </script> 

however, when reaches $(element).sumoselect(); produces error "0x800a01b6 - javascript runtime error: object doesn't support property or method 'sumoselect'"

i'm new jquery/javascript, have tried multiple permutations of trying call function , pass object, none have worked.

any ideas me working?

i'll grateful assistance.

first of all, using jquery, why bother using vanilla javascript dom elements, , iterate on collection, 1 element id? (id property should unique in document)

you can refactor code , initialize plugin on elements meet selector criteria:

$(document).ready(function () {   $('#fieldid_3').sumoselect(); }); 

if no elements meet criteria, plugin not initialized (safely), because jquery return empty like-array object.

and obviously, element id fieldid_3 must select element, mentioned here: https://hemantnegi.github.io/jquery.sumoselect/


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

android - Go back to previous fragment -