I want to modify the titlebar jquery plugin showcase, I added the <p class='title> to the description tag so that I can apply css styles to the title and to separate that portion to the actual description.
Script:
var $a = $("<a />").attr("href", $container.find("a:first").attr("href")).html("<span>" + $container.find("a:first img").attr("alt") + "</span>");
var $titleBar = $("<div id='subBar' />").html($a);
HTML output:
<div id="subBar"><span><p class="title">Lorem</p>description here</span></div>
From the above structure how can I add css via jquery if <p class='title'> is encountered? I want to add css styles to class title, which is impossible to css because this is generated by javascript.
pelement cannot be a child element of aspanelement. Browser error correction will almost certainly cause inconsistent behavior that trips you up as different browsers try to recover from your error in different ways.