how to add js for input onfocus
Application Type
Reactive

i am developing the application in which whenever i will click on input field the selective picture from the right should get selected how can i get that? 

desired output...


i am trying to add js in onfocus of input field  and trying getElementById i am getting element id there but i am not able to implement style.border i need to add border in that 

 

GetQuote.oml

Solution

Hi @Vaibhav singh Baghel ,

Your bottom-right image that you want highlighted has the id "handset", so just pass that id of that element to the javascript node and type the following:


Just adjust the color and styles to your need. your issue was that you were trying to give those styles to a wrong element!

Let me know if this helped!
Cheers,
Paulo

hi,

thanks for your help but after that field goes unfocused it is still highlighted it should be only till the field is onfocus.

For that you can remove the styles you previously added on the OnBlur action. onblur action happens when you leave the field.

And in that case, it is better if you write a css class with the styles you want to apply,and in the onfocus event you add that class to your element classList.

On the onblur event, you remove that class from the element classlist!


Tell me if this helped!
Paulo

Thanks for your kind help.

It helped me a lot. 

cheers,

Vaibhav

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.