Jquery Modal and css styles -
i want set background color of elements within dialog has class of matchedon
.
i have following code:
$('.matchedon').each(function () { if ($(this).html() == matcheditem) { $(this).css({ "color": "green", "background-color": "#ffff00" }); } });
matcheditem
local variable used check content of element. example, if element class of matchedon
, contains 'fred', 'fred' matcheditem
, set neccessary css.
this works fine first tab within modal. however, though have class defined on second tab, 'fred' css isn't applied.
i have jquery code, after html drawn modal, it's not issue of checking against isn't there.
* edit ** hi it's senstive data, can't display all. however, each tab has following
<div id="tab6"> <div id="results1"> <div class="message"> <h2>title</h2> <pre> <dl> <dt>heading</dt> <dd class="matchedon">fred</dd> </dl> </pre> </div> </div> </div> <div id="tab7"> <div id="results2"> <div class="message"> <h2>title</h2> <pre> <dl> <dt>heading</dt> <dd class="matchedon">fred</dd> </dl> </pre> </div> </div> </div>
so in situation, tab 6 has style applied, not in tab7
the problem code block executed once when other tabs hidden. code should execute when other tabs become active in order change css on visible items. intercept activate
event , execute code in it:
$('.yourtabdiv').tabs({ activate: function() { $('.matchedon').each(function() { if($(this).html() == matcheditem) { $(this).css({ "color": "green", "background-color": "#ffff00" }); } }); });
Comments
Post a Comment