Reputation: 3530
I've got some code which when you click a button it populates the text of a textbox and then prepends another button to that div.
It works in all browsers except IE where it gives a javascript error.
The only way I can easily explain is by using my jsFiddle
If you use that in any browser apart from IE and click the Book now
select a date and then another button will appear Submit
.
This is the correct behaviour but if you use IE then as soon as you select a date there's a javascript error Unexpected call to method or property access
Any ideas?
Thanks
Upvotes: 0
Views: 284
Reputation: 3697
The problem is with these two lines
$(".dupeadultcost").html($(this).parent().siblings().find(".adultcost").html());
$(".excursionSubmitButton").prependTo($(this).parent()).show(); // show form submit button
You need to replace class slectors (e.g. .dupeadultcost to id selectors #txtAdultcost) and it will work
Upvotes: 0
Reputation: 35793
The problem is caused by this line:
$(".dupeadultcost").html($(this).parent().siblings().find(".adultcost").html());
As there is a textbox with a class of dupeadultcost this is blowing up in IE. If you only want to set the span I suggest you use:
$("span.dupeadultcost").html($(this).parent().siblings().find(".adultcost").html());
Working example - http://jsfiddle.net/d9TP8/1/
Upvotes: 2