client side

  • Thread starter Thread starter abcd
  • Start date Start date
A

abcd

This is more of a HTML/javascript question

I have a select control

<select>
<option value = "1"> abcd </option>
<option value = "2"> my&nbsp;Name </option>
<option value = "3"> your&nbsp;Name </option>
</select>

I am comparing the values of the text property of the select control....my
comparisions fails...how to handle that &nbsp; while comparing....

e.g.

var testString = "my Name"

how can I compare this with the option value for exact match....

any tips
 
Here's one way - inject &nbsp into the blank, like this...

var testString = "my Name".Replace(" ", "&nbsp;");

Remember - strings, like "my Name" are objects in .NET - so you can call
methods of them - like .Replace()...

-HTH
 
You can safely use normal spaces in the <option> tags. It won't make any
difference for the page look and you can compare strings in a regular way.


Eliyahu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top