2016-04-08 14 views
0

ich bin dynamisch hinzufügen li tag zu UL .die folgende ist sehr komplex li tag, mit dem ich syntax issue.Could jemand bitte helfen, zu beheben folgenden tag. Alle grundlegenden Tutorials, um diese Art von Links auch groß zu bilden.jquery li binding ul syntax problem

Ich versuche, Link mit einigen Bedingungen zu binden.auf einen Link öffnet es eine neue Seite./

Sie tun etwas grundlegend falsch:

notifcationUL.append('<li><div class="pull-left"><a href="javascript:window.open(<%=ResolveUrl("~/App Web Pages/Generic/PageTableUIControl.aspx?Entity=Notifications&EntityObject=EIS_Notifications&UpdateModeLoad=false&WhereCondition=Main.[NotificationUserID]='"+ $("#hdnUser").val() + "' and Main.NotificationCreatedDate='" + today + "'%>",mywindowtitle)"><strong>See All Notifications</strong><i class="fa fa-angle-right"></i></a></div><div class="pull-right"> <a href="#" class="btn btn-sm btn-info removenotifications">Clear Notifications <span class="glyphicon glyphicon-trash pull-right "></span></a></div></li>');

Antwort

0

Sie können nicht Server-Seite ASP-Code auf der Seite, auf der Client-Seite mit Jquery hinzufügen. Können Sie Ihre Frage bearbeiten und erklären, was Sie erreichen möchten?

+0

Resolve url verwendet Client-Seite jquery werden kann. Ich habe den Code geändert. Können Sie überprüfen, und lassen Sie mich wissen, wo ich Fehler mache – MaheshMajeti

0

Ihre Angebote sind aus. Wenn Sie irgendetwas mit jQuery anhängen, müssen die inneren Anführungszeichen dem äußeren Anführungszeichen gegenüberstehen. Siehe unten.

Ihre Syntax:

notifcationUL.append('<li><div class="pull-left"><a href="<%=Page.ResolveUrl("~/App Web Pages/Generic/PageTableUIControl.aspx?Entity=Notifications&EntityObject=EIS_Notifications&UpdateModeLoad=false&WhereCondition=Main.[NotificationUserID]='"+ $('#hdnUser").val() + "' and Main.NotificationCreatedDate=" + today + '%>","mywindowtitle")"><strong>See All Notifications</strong><i class="fa fa-angle-right"></i></a></div><div class="pull-right"> <a href="#" class="btn btn-sm btn-info removenotifications">Clear Notifications <span class="glyphicon glyphicon-trash pull-right "></span></a></div></li>'); 

korrekte Syntax:

notifcationUL.append('<li><div class="pull-left"><a href="<%=Page.ResolveUrl("~/App Web Pages/Generic/PageTableUIControl.aspx?Entity=Notifications&EntityObject=EIS_Notifications&UpdateModeLoad=false&WhereCondition=Main.[NotificationUserID]="' + $("#hdnUser").val() + '" and Main.NotificationCreatedDate=" '+ today + '"%>","mywindowtitle")"><strong>See All Notifications</strong><i class="fa fa-angle-right"></i></a></div><div class="pull-right"> <a href="#" class="btn btn-sm btn-info removenotifications">Clear Notifications <span class="glyphicon glyphicon-trash pull-right "></span></a></div></li>'); 
+0

Es gibt Fehler bei $ ("# hdnUser"). val() – MaheshMajeti

+0

Ich starre für eine lange Zeit und nicht sehen ein Unterschied zwischen den beiden: S – seahorsepip

+0

Verwendung in der Diff-Checker und Sie werden den Unterschied in jeder Zeile sehen --- >>> https://www.diffchecker.com/ – KpTheConstructor