[Rails]jQuery: Syntax error, unrecognized expression -
i've problem rails 3 app: i've script in view display progress bar upload (the upload process works):
<h1>ajouter des images:</h1> <%= form_for [:admin, :gallery, @painting], html: { multipart: true} |f| %> <%= f.hidden_field :gallery_id %> <%= f.label :image, "upload paintings:" %> <%= f.file_field :image, multiple: true, name: "painting[image]" %> <% end %> <script id="template-upload" type="text/x-tmpl"> <div class="upload"> {%=o.name%} <div class="progress"><div class="bar" style="width: 0%"></div></div> </div> </script>
but when seek upload file, got error:
uncaught error: syntax error, unrecognized expression: <div class="upload"> argentina.gif <div class="progress"><div class="bar" style="width: 0%"></div></div> </div>
coming form jquery.js file:
sizzle.error = function( msg ) { throw new error( "syntax error, unrecognized expression: " + msg );
i don't know how prepare it, i've sought lot ! help !
this happening because of identation within template tag. check out: jquery-htmlstring-versus-jquery-selectorstring
you can avoid using $.parsehtml()
:
data.context = $($.parsehtml(tmpl("template-upload", file))[1])
jquery ruby-on-rails syntax-error sizzle
No comments:
Post a Comment