开发者

link div to input text in firefox

开发者 https://www.devze.com 2023-02-03 04:08 出处:网络
I\'m using google maps api to have a map show up on my website where visitors can also find directions. I have a starting point setup and an end point. Both are text areas. The start is empty, but I w

I'm using google maps api to have a map show up on my website where visitors can also find directions. I have a starting point setup and an end point. Both are text areas. The start is empty, but I want the end point to be populated with the address from a div that I already have in the page. I have the javascript as:

var address = document.getElementById("address").innerText.replace(/\n/g, " ");

It works in Chrome, but Firefox shows the text in the endpoint box as 'undefined.' And Fire开发者_StackOverflow社区bug is giving me -

document.getElementById("address").innerText is undefined [Break On This Error] var address = document.getElementB...ress").innerText.replace(/\n/g, " ");

Any help is appreciated.

Thanks


try using innerHTML instead of innerText.

if that doesn't work how you want it to, try:

var address = element.innerText || element.textContent;


figured it out...

just need to replace innerText with textContent for firefox.

0

精彩评论

暂无评论...
验证码 换一张
取 消