简体   繁体   中英

HTML, JS, get only displayed value of the element

I have some div s in my code and I have applied text-overflow: ellipsis to them.

Let's say the first div has value of: "Hello I am a div element" and since there is text-overflow being applied the displayed value is: "Hello I am...".

I want to know if there is a way to get the displayed value instead of full value ?

根据使用情况,最简单的方法可能是同时设置title属性,因此在鼠标悬停时,您可以看到全文:

<div title="Hello I am a div element">Hello I am a div element</div>

create hidden inputs for every signle div and make input,and div have i unique id ,

in java script you can check value by equles div and input with same id .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM