jquery selector not working, why?

前端 未结 8 609
挽巷
挽巷 2021-01-18 09:29

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

8条回答
  •  被撕碎了的回忆
    2021-01-18 10:04

    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/

提交回复
热议问题