Find input button within a selected class div

user610983 picture user610983 · Aug 25, 2011 · Viewed 32.9k times · Source

How could I use jquery to find out this button within a div with class name "blueheaderbar accordionButton on" then change button value to "hide it"

<div class="blueheaderbar accordionButton selected" style="margin-top:20px">
            <div class="floatleft">abc</div>
            <div class="floatright"><input class="showhidebtn" type="button" value="Show Outlet" style="margin:6px 16px 0 0; width:86px" /></div>
            <div class="clear"></div>
</div>

<div class="blueheaderbar accordionButton" style="margin-top:20px">
            <div class="floatleft">abc</div>
            <div class="floatright"><input class="showhidebtn" type="button" value="Show Outlet" style="margin:6px 16px 0 0; width:86px" /></div>
            <div class="clear"></div>
</div>

Answer

shernshiou picture shernshiou · Aug 25, 2011

I think the answer is:

$("div.blueheaderbar.selected").find("input").val("hide it");