The CreatorCon Call for Content is officially open! Get started here.

Reference jquery library from client script

uluerje
Mega Expert

I have a dropdown list with three options - green, yellow, red.   Each OPTION has it's own background color so when the user expands the list they see the actual color instead of the text.   I was able to create the dropdown using an onLoad script, however, I haven't figured out how to get rid of that blue highlight on the dropdown!   I'd like to just remove it all together so that on mouseover, all you see is the background color of the option instead of the blue.   As it stands now, the blue replaces the background color of the option which kind of defeats the purpose of having it in the first place.   Since this is on a form and not a UI page, I'm having issues referencing the jquery library. I've been trying to figure this out for a while and I feel like I'm going around in circles, so I'll take any help I can get!!!   Thanks!!!

 

The following example works fine with a UI page but I can't get it to work on the form -   Reinventing drop down with CSS and jQuery - demo

1 ACCEPTED SOLUTION

solutioningnow
Giga Guru

Hi Jessica,



To use jquery in Client script you need to follow steps:



1) Mark UI script "jquery.min" or "jquery" library as Global.


2) Use "$j" instead of "jQuery" to call it.




You can check below site also:


http://jylertones.com/blog/2013/05/the-right-way-to-use-jquery-with-servicenow/



Please mark answer as correct/helpful, if it was really helpful



Regards,


Solutioner


Logo.png


Enhance Knowledge NOW@ www.solutioningnow.com


http://www.solutioningnow.com/


View solution in original post

4 REPLIES 4

solutioningnow
Giga Guru

Hi Jessica,



To use jquery in Client script you need to follow steps:



1) Mark UI script "jquery.min" or "jquery" library as Global.


2) Use "$j" instead of "jQuery" to call it.




You can check below site also:


http://jylertones.com/blog/2013/05/the-right-way-to-use-jquery-with-servicenow/



Please mark answer as correct/helpful, if it was really helpful



Regards,


Solutioner


Logo.png


Enhance Knowledge NOW@ www.solutioningnow.com


http://www.solutioningnow.com/


Thanks for your reply.   Do you know if it's best practice to use a variable other than $j to avoid any issues with the version?      


Yeah that's the best practice to use a variable other than $j and other than $. You can call it $j_custom, you can call it.


var $j_custom = jQuery.noConflict(true)



Please mark answer as correct/helpful, if it was really helpful



Regards,


Solutioner


Logo.png


Enhance Knowledge NOW@ www.solutioningnow.com


http://www.solutioningnow.com/


Thanks for your help!