javascript - getElementById inside a div -


i'm using javascript change text on form submit button, code i'm using:

<script type="text/javascript"> $(document).ready(function(){   document.getelementbyid("button").value="new button text"; }); </script> 

the code work perfectly, need change effects id #button within div id of #formwrap. need .getelementbyid("button") contained within div id of #formwrap

if using jquery, why not do

$('#formwrap #button').val('new button text'); 

?

it's css-like selector, similar you'd use in queryselectorall().

it match example button:

<div id="formwrap"><input type="button" id="button"></div> 

but keep in mind 1 element can have same id.

maybe wanted class? you'd use .button instead of #button.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -