Skip to main content

Bug Tracker

Side navigation

#6331 closed bug (worksforme)

Opened March 22, 2010 03:42AM UTC

Closed October 07, 2010 06:16AM UTC

BUG on Setting value to hidden input

Reported by: jennal Owned by:
Priority: undecided Milestone: 1.4.3
Component: manipulation Version: 1.4.2
Keywords: val Cc:
Blocked by: Blocking:
Description

I try to set a long html to a input:text, it is ok.

But when I set the input to hidden, then set the same html value to it. The input gone.

Please see attach.

Attachments (1)
  • test2.html (2.5 KB) - added by jennal March 22, 2010 03:43AM UTC.
Change History (1)

Changed October 07, 2010 06:16AM UTC by addyosmani comment:1

priority: → undecided
resolution: → worksforme
status: newclosed

I've tested the above bug in Safari and FireFox (latest builds) and it would appear that a few things are going on here:

1. Your test to establish whether the value of the long piece of text/html being set to the input field value is incorrect.

Rather than checking the length of the input field itself, you want to be checking the length of $('#test').val().length instead.

This will give you a value of over 2000 rather than the value of 1 you were previously getting.

2. Using $('#test').val() once you have set your hidden field's value, you are easily able to re-use the value set (I was able to alert the entire html/text string without any trouble at all).

Closing as this works for me. I think it was just a case of the original submission testing for attribute lengths in the wrong way.