Solution 1 :

The problem is because parsing a non numeric value with jQuery is not allowed on an input type="number"

If you really want to use '' properly better use type="text"

Edit:

There is a reference about this on developer.mozilla.org/…/isNaN

isNaN(”); // false: the empty string is converted to 0 which
is not NaN

Some more explaination on jQuery Allow Numbers and Decimal only in Textbox [numeric]

Problem :

I have a jquery.number textbox with value 0

When I run $('#txt').val(1); it becomes 1 (so far so good)

When I run $('#txt').val(''); it becomes 0 ! Not good, I want to clear it.

document.getElementById('txt').value = ""; This works, but I’d prefer using jquery…

Anyone has a clue on what might be going on?

Comments

Comment posted by zb22

can you show some of your code?

Comment posted by user1311463

This is the generated html

Comment posted by user1311463

It already has type=”text” and still have same issue

Comment posted by B.S.

in your previous comment you mention this code :

By