Select an element with jQuery selector regardless of ID -


i have following code:

<div>  <div id="someid"><h1>blah</h1></div>  <div id="someid2"><h1>blah</h1></div> </div> 

and trying select in jquery (for accordion in jquery ui). however, following not work unless remove id div.

$('> div > h1') 

is there way tell selector ignore id, or going wrong way?

edit: actual use i'm going in sortable accordion in jquery ui, ids on div elements. example of i'm doing, source, can found here:

http://jqueryui.com/demos/accordion/#sortable


edit: have feeling may related jqueryui, rather selectors themselves, below code i'm trying run.

http://jsfiddle.net/zgkj4/1/

working example without id in div:

http://jsfiddle.net/zgkj4/2/

you try selecting <h1> parent <div> has id attribute

$("div > div[id] > h1") 

working example: http://jsfiddle.net/yjsvu/


ignores div w/o id: http://jsfiddle.net/yjsvu/1/


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -