Why is that changing a button text doesn't work in Opera 11.11 for elements like
<input type="submit" value="Asdasd" id="blahblah_button" />
? (Didn't try it in earlier versions yet.)
I tried it with jQuery and with "pure" JavaScript too, none of them worked.
This is the jQuery code I tried:
$('#blahblah_button').val('Blah-blah');
and this is the "pure" JS-code:
document.getElementById('blahblah_button').value = 'Blah-blah';
Why is that none of them worked in Opera 11.11?
It DOES work in IE, Chrome and FF, it surprises me that it doesn't work in Opera.
I have to mention that it DOES work for button tags like this in Opera too:
<button id="test_button" onclick="$(this).text('Blahblah');">Some text</button>
Thanks for your answers in advance!
EDIT I. (0:40)
I forgot to mention that querying the button's value after the modification gives the result that it seems to work fine, which means it changes the structure in JS DOM, but doesn't rerender the visible button appropriately.
This is the example code with which you can try this behaviour:
http://jsbin.com/inuxix/1/edit
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="hu" xml:lang="hu">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Changing button text</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js" type="text/javascript"></script>
</head>
<body>
<p>Button tag - WORKING
<button onclick="$(this).text('Blahblah_1');" id="test_button">Button_text (button_tag)</button>
</p>
<p>Input tag (type: submit) - NOT working
<input onclick="$(this).val('Blahblah_2');" type="submit" value="Submit_text" id="blahblah_submit_type" />
</p>
<p>Input tag (type: button) - WORKING
<input onclick="$(this).val('Blahblah_3');" type="button" value="Button_text" id="blahblah_button_type" />
</p>
<p>
<button onclick="alert($('#blahblah_submit_type').val());" id="val_button">Getting blahblah_submit_type's value</button>
</p>
</body>
</html>
EDIT II. (4:41)
But I also have to mention that it DOES work for input elements with "button" type - so I complemented my code above with an element like this. I also marked which types do and which don't work.
EDIT III.
In the meantime, I tested it, and it doesn't work in Opera <= 11.11, but this bug has been fixed in Opera 11.50 though.
Blah-blah
as value for the submit button. It would definitely mean that there is a bug in jQuery and/or Opera 11.11 which once again I would be extremely highly surprised. – Trinetta