Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is .innerText not working in Firefox? [duplicate]

Here is my code It's working perfect in all browsers but not in Firefox.

I tried many thing but didn't work at all. Please can some one help me on this issue. Am I doing something wrong.?

Is there any other way.?

I'M USING .innerText because values are coming from

<span class="jr-rating-wrapper-jr_stars-new-0">
 4.5
</span>

There is no error on console.

<script type="text/javascript">
   jQuery('#submitButton').click(function(){
   var PostStartone = document.getElementById('jr-rating-wrapper-jr_stars-new-0').innerText;
   var PostStarSec = document.getElementById('jr-rating-wrapper-jr_stars-new-1').innerText;
   var PostStarThird = document.getElementById('jr-rating-wrapper-jr_stars-new-2').innerText;
   var PostCapVal = document.getElementById('code').value;
   var PostRBVal = "";
   var selected = jQuery("div.jr_fieldDiv input[type='radio']:checked");
   PostRBVal = selected.val();
   jQuery.post("http://xyz/x/Update.php", { 
      GetStarOneValue : PostStartone ,
      GetStarSecValue : PostStarSec ,
      GetStarThirdValue : PostStarThird ,
      GetCaptchValue : PostCapVal,
      GetRadioBTNValue : PostRBVal});
 });
</script>
like image 567
user3474130 Avatar asked Apr 10 '14 14:04

user3474130


1 Answers

innerText is the "old Internet Explorer" way of doing it.

Try textContent instead. Ideally you should use elem.textContent || elem.innerText, but if you're using jQuery you can just do jQuery("#the_id_here").text().

like image 101
Niet the Dark Absol Avatar answered Nov 20 '22 12:11

Niet the Dark Absol