ajax - The function 'has' is not working on loaded data using jQuery -


i using function has() checking if li tag has ul inside. if ul tag in li add css properties, code works when li tags created while rendering page when use ajax , $.each() creating these li items has() not work.

the jquery code is:

$('.inneritems li ul li').has('ul').css({'background-image':'url(images/arrow.png)',                                          'background-position':'2px center',                                          'background-repeat':'no-repeat'});  

use .find instead, .has test whether has ul.

$('.inneritems li ul li').find('ul').css({'background-image':'url(images/arrow.png)',                                          'background-position':'2px center',                                          'background-repeat':'no-repeat'});  

edit: seems want instead:

$('.inneritems li ul li:has(ul)').css({'background-image':'url(images/arrow.png)',                                          'background-position':'2px center',                                          'background-repeat':'no-repeat'});  

Comments

Popular posts from this blog

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

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

php - Controller/JToolBar not working in Joomla 2.5 -