Category : ejs

currently <%=item.id%> shows red underline saying expected an expression. i want my button to act as a link to redirect it to lists/item._id but because its not a form these double quotes are causing issues. so any way i can fix this?? <button type="button" onclick="/lists/<%=item._id%>" class="btn btn-success">Start solving</button> is there any way to fix it ..

Read more

I’m working on my web appliction using JQuery. My select option menu doesn’t print selected option. $(function() { $(document).on(‘click’, “.class”, function() { var id = $(this).attr(“id”); var index = $(‘#mySelect’).val(); if (id == “mySelect”) { /* for(let i=0; i<3; i++) $(“#mySelectOptionIndex”+i).attr(“selected”, false) $(“#mySelectOptionIndex”+index).attr(“selected”, true) */ $(“#mySelect”).val(index); } }); }); <script src=”https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js”></script> <select id=”mySelect” class=”form-control form-control-sm ..

Read more

Im sending a stringified json that should have property: recievedObject: {"code":"this is a code snippet"} (the code property has no specified programming language) and then parsing it like this: var items = JSON.parse(‘<%- JSON.stringify(items) %>’) When I try to parse the stringified json I received I get parsing errors (im guessing its because of the ..

Read more