It show error in the dreamweaver

$('#left_bar .cart-info').append('<div>'+localStorage["myid"] = document.getElementById("myid").value =parseInt(localStorage["myid"] || "0", 10) + 1;+'<input id="myid" type="text" name="itemquantity[]" value="1"/></div>');

Recommended Answers

All 2 Replies

you misssed sigle quotation mark where i showed BOLD letters in your code (at + sign before input tag started at the end)

$('#left_bar .cart-info').append('<div>'+localStorage["myid"] = document.getElementById("myid").value =parseInt(localStorage["myid"] || "0", 10) + 1;'+'<input id="myid" type="text" name="itemquantity[]" value="1"/></div>');

let me know the status after updating the code

Member Avatar for stbuchok

that won't fix the issue as there is a semi colon, also the + with the single quote on the right is fine.

Try this. Also think about readability, if it's hard to read, it's hard to understand.

document.getElementById("myid").value = (parseInt(localStorage["myid"] || "0", 10) + 1);

localStorage["myid"] = document.getElementById("myid").value;

$('#left_bar .cart-info').append('<div>' + localStorage["myid"] + '<input id="myid" type="text" name="itemquantity[]" value="1"/></div>');
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.