dar2o3 Active Member Licensed User Longtime User May 17, 2016 #1 when ws.eval use to inject HTML code, I have a problem when I try the following Code: Copy ws.Eval("$('#expe').append("<span class=new badge>4</span>"), Array As Object() ) and I tried this but it does not work Code: Copy ws.Eval("$('#expe').append("<span class=new class=badge>4</span>"), Array As Object() ) when "class = one two three" has more than one property does not work properly. any suggestions? Last edited: May 17, 2016
when ws.eval use to inject HTML code, I have a problem when I try the following Code: Copy ws.Eval("$('#expe').append("<span class=new badge>4</span>"), Array As Object() ) and I tried this but it does not work Code: Copy ws.Eval("$('#expe').append("<span class=new class=badge>4</span>"), Array As Object() ) when "class = one two three" has more than one property does not work properly. any suggestions?
Erel B4X founder Staff member Licensed User Longtime User May 18, 2016 #2 In which way doesn't it work? The code you posted will not compile. You need to escape quotes or use smart strings instead. Upvote 0
In which way doesn't it work? The code you posted will not compile. You need to escape quotes or use smart strings instead.
dar2o3 Active Member Licensed User Longtime User May 18, 2016 #3 thanks for answering I use materializecss framework, this html code produces the following Code: Copy <a href="#" class="collection-item">Unread<span class="new badge">4</span></a> but this code in b4j produces the following *1 Code: Copy ws.Eval("$('#expe').append('<a href=# class=collection-item>Imbox<span class=new badge>12</span></a>')",Array As Object()) and this code gives this result *2 Code: Copy ws.Eval("$('#expe').append('<a href=# class=collection-item>Imbox<span class=new>12</span></a>')",Array As Object()) the difference in the two previous examples is in *1<span class=new badge> *2 <span class=new> the same code does not work with single quotes. Code: Copy ws.Eval("$('#expe').append('<a href=# class='collection-item'>Inbox<span class='new badge'>4</span></a>')",Array As Object()) I understand it is a problem with the quotes, but not how to fix it. I solved the problem by using. Code: Copy expe.SetHtml("<a href='#' class='collection-item'>Unread<span class='new badge'>4</span></a>") but I continue to wonder how to do with ws.eval. Last edited: May 18, 2016 Upvote 0
thanks for answering I use materializecss framework, this html code produces the following Code: Copy <a href="#" class="collection-item">Unread<span class="new badge">4</span></a> but this code in b4j produces the following *1 Code: Copy ws.Eval("$('#expe').append('<a href=# class=collection-item>Imbox<span class=new badge>12</span></a>')",Array As Object()) and this code gives this result *2 Code: Copy ws.Eval("$('#expe').append('<a href=# class=collection-item>Imbox<span class=new>12</span></a>')",Array As Object()) the difference in the two previous examples is in *1<span class=new badge> *2 <span class=new> the same code does not work with single quotes. Code: Copy ws.Eval("$('#expe').append('<a href=# class='collection-item'>Inbox<span class='new badge'>4</span></a>')",Array As Object()) I understand it is a problem with the quotes, but not how to fix it. I solved the problem by using. Code: Copy expe.SetHtml("<a href='#' class='collection-item'>Unread<span class='new badge'>4</span></a>") but I continue to wonder how to do with ws.eval.
Erel B4X founder Staff member Licensed User Longtime User May 19, 2016 #4 Use smart strings literal and you will be able to add whichever quotes you need. https://www.b4x.com/android/forum/threads/b4x-smart-string-literal.50135/#content Upvote 0
Use smart strings literal and you will be able to add whichever quotes you need. https://www.b4x.com/android/forum/threads/b4x-smart-string-literal.50135/#content
dar2o3 Active Member Licensed User Longtime User May 19, 2016 #5 It's great, works great, thank you very much for your help. Upvote 0