I simply want to manipulate the elements within the #content div, but $(\'#content\') doesn\'t seem to work, and yet in other places it does! My relevant code i
For this question you should go straight to jsfiddle, and to the jquery docs for how to get attributes of html elements -> http://api.jquery.com/attr/.
The jQuery selector object itself doesn't have an attribute id. You have to use .attr('id') function.
I fixed that and everything else works, as you see in this jsfiddle: http://jsfiddle.net/AdtrX/1/
what led me to this page is
I have this div with id LING_a_00224.s03
<div id="LING_a_00224.s03" ></div>
and when I use jquery selector to get it
$("#LING_a_00224.s03")
I got not element (jquery selector not working)
thats because the dot (.) in the id
jquery will interpret it as All elements with id="LING_a_00224" and class="s03", not All elements with id="LING_a_00224.s03"
so make sure that id selector does not contains jquery selector symbols like (
.)
or
if you don't have control over elements ids, you can do
selector=document.getElementById("LING_a_00224.s03");//JQuery selector sometimes fails because id may contains dot on it like #fn12.e2e
$(selector).jqueryFunction()// wrap the JavaScript object into $() to convert it to jquery object
hope this helps you