jquery - how to get prototype div selector as object -


i'm noob prototype/jquery, , when try in chrome console, on page div called "contains_filter_select":

>> $("contains_filter_select" ) <div id=​"contains_filter_select">​…​</div>​ 

but appears somehow not object?

>> $("contains_filter_select").text("abc") typeerror: object #<htmldivelement> has no method 'text'   $("#contains_filter_select")  null 

i feel i'm missing trivial here, point me in right direction?

you said:

>> $("contains_filter_select").text("abc")

typeerror: object #<htmldivelement> has no method 'text'

that suggests me aren't using jquery @ all, other library. there several libraries use $ symbol: jquery, prototype, , mootools (at least). way both prototype , mootools work, when use $("contains_filter_select"), you'll reference actual div object; jquery different, jquery wrapper around matching set of elements (and string css-style selector, # before element id, unlike prototype , mootools it's id value). jquery, wouldn't error you're getting, if selector didn't work. prototype or mootools, i'm pretty sure would, neither of them adds text method elements.

so answer is: don't think you're using jquery on page @ all. double-check script tags. (fwiw, if happen using popular on-line tool jsfiddle, defaults mootools if don't change drop-downs on left.)


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -