TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Kwasi Denkyira
1.5k
197
14.8k
Get the value inside element give me double \n in empty case
Dec 7 2019 6:24 AM
I am using MVC 5 and html table to render a view. In one of the table cell, I want to check if the value inside the td tag is null or not and show or hide an item using JQuery. I am using the code below but for some reasons the value inside the tag is showing "\n \n" and therefore always not null. I have included a screen and my code. Any help to remove "\n \n" so I can check if the value is null or not will be appreciated.
$(document).ready(
function
(){
$(
"button"
).click(
function
()
{
var
v = $(
"#hideheader"
).html(); ----> This value here is showing
"\n \n"
if
(v==
''
) --- This is always not empty
{
alert(
'empty'
);
$(
"#hide"
).hide();
}
else
{
alert(
'non-empty value'
);
}
});
});
<table>
<thead><tr> <th id=
"hide"
>ID</th></tr> </thead>
<tbody><tr><td id=
"hideheader"
>@item.adminstring</td></tr></tbody>
</table>
Reply
Answers (
1
)
The type initializer for filepath threw an exception.
Web Api in asp.net