Change Value Of Div Using Jquery .val() Not Working
I have this div:
asdf
and this code: $('#libraryDisplay').val(booksList); and booksList is a string. It's still displaying 'asdf'. AnySolution 1:
val
is for form elements. If you're trying to set the text of the <div>
, use text
instead:
$('#libraryDisplay').text(booksList);
If booksList
is actually an HTML fragment (and you're reasonably sure it's coming from a safe source and doesn't have the potential to corrupt your page) use html
:
$('#libraryDisplay').html(booksList);
Post a Comment for "Change Value Of Div Using Jquery .val() Not Working"