8 ist not "8" in a javascript comparison
<p>I have a hidden field with value "8" and I return json data from my asp.net mvc controller where the templateId has a value of 8.</p>

<p>"8" is not 8. Thats fine but how can I compare then both values?</p>

<p><img src="http://i.stack.imgur.com/z5NhU.png" alt="enter image description here"></p>
