We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,496 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Whats goes wrong with this code ???

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

4
Contributors
2
Replies
2 Hours
Discussion Span
3 Months Ago
Last Updated
5
Views
mehar89
Newbie Poster
4 posts since Feb 2013
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 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

radhakrishna.p
Posting Whiz in Training
263 posts since Nov 2012
Reputation Points: 29
Solved Threads: 59
Skill Endorsements: 10

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>');
stbuchok
Practically a Posting Shark
876 posts since May 2011
Reputation Points: 138
Solved Threads: 124
Skill Endorsements: 2

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.2864 seconds using 2.66MB