为什么.innerText无法在Firefox中运行?
这是我的代码它在所有浏览器中都很完美, 但在Firefox中却没有。
我尝试过很多东西,但根本没用。 请问有人可以帮我解决这个问题。 难道我做错了什么。?
还有别的办法吗?
我正在使用.innerText,因为价值来自
控制台上没有错误。
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}); });
innerText
是“旧的Internet Explorer”方式。
请尝试使用textContent
。 理想情况下,您应该使用elem.textContent || elem.innerText
elem.textContent || elem.innerText
,但是如果你使用的是jQuery,你可以只使用jQuery jQuery("#the_id_here").text()
。