first of all, jQuery is javascript, it's a library written in javascript.
So, If I understand your problem, you have 3 interactive elements on your page:
- a list box containing a list of words
- a text field for the user to enter a word
- a button for the user to click when he has written the text.
And you want the option to change color when the user clicks the button.
the code for thsi would be something like this:
$("#mybutton").click(function(){
var text = document.getElementById("mytextinput").value
$("#lstCodelist option").each(function (){
if(this.text()===text)
this.css('color':'yellow');
});
});
this is what happens:
- line 1: I define a click handler when the button gets clicked.
- line 2: I get the text from inside the textbox, I use getElementById to avoid the overhead of using jQuery for something that simple
- line 3: I loop over each of the items in the list.
- line 4: if the string in the textbox equals the text inside the option:
- line 5, change the css property of the list option.
So no, this is not affecting the text, it only edits the css.
ul(orol) in place of aselect.