function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Mustafa JhabuawalaMustafa Jhabuawala 

Not able to access DOM element of same component using class selector jQuery when Locker Service is Activated

Hi #SalesforceOhana I need urgent help on this, I have gone through the salesforce documents which says that when locker service is activated you will not be able to access elements generated by other components which is far enough :) , but what I am trying to do is to access the element generated by same component but no luck :( when locker service is activated.

Below are the details - 

Lightning Application - LS_SampleA
<aura:application >
	<c:LS_SampleC></c:LS_SampleC>
</aura:application>

Lightning Component - LS_SampleC
<aura:component >
    <ltng:require scripts="/resource/jquery"/>
	<ui:outputText aura:id="trialField" class="trialField" value="Lightning Locker Service"/>
    <ui:button press="{!c.highlighter}" label="Color" />
</aura:component>
LS_SampleCController.js
({
	highlighter : function(component, event, helper) {
        debugger;
		$(".trialField").addClass("color");
	}
})

LS_SampleC.css
.THIS.color {
    background-color: #fdd987!important;
}

App Preview - 
User-added image

When user clicks on Color button, text gets colored. This is working only if locker service is deactivated.

When locker service is deactivated - 
User-added image

When locker service is activated - 
User-added image

Thanks in advance