0

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>');

Edited by mehar89

3
Contributors
2
Replies
5
Views
4 Years
Discussion Span
Last Post by stbuchok
0

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

Edited by radhakrishna.p: giving clarity on the problem

0

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>');
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.