javascript - jQuery get html in div without any markup -


i have script written using jquery framework.

var site = { link: $('#site-link').html()  } 

this gets html in div site-link , assigns link. later save link db.

my issue don't want html see being dangerous, maybe?

i have tried:

 link: $('#site-link').val() 

... gives me blank value.

how can value inside div without markup?

try doing this:

$('#site-link').text() 

from jquery api documentation:

get combined text contents of each element in set of matched elements, including descendants, or set text contents of matched elements.


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -