I have an xml file like this:
<Product ID="1" Code="AAAA AA" Price="10"/>
<Product ID="2" Code="AAAA AA" Price="20"/>
I load 'Code' into tag
$('#select1').append($('<option></option>').val('1').html($(this).attr('Code')));
and I compare the value of select1 and the value from XML path:
function()
{
var e = document.getElementById('textbox1');
var proValue= e.options[e.selectedIndex].text;
if($(this).attr('Code')==proValue)
{
var proPrice = $(this).attr('Price');
document.getElementById('textfbox2').value=proPrice;
}
}
The problem is that $(this).attr('Code')==proValue
returns false with ID='2' as the value of it has two spaces.
However, it works fine with the one with ID='1'.
Any ideas of how can I fix it?