0


How do I change the input type? I want to use a class or id from CSS, without breaking my script.

My input type is 'button' which puts a generic looking button on the page. I want to use #myStyle instead. Please help.
Thanks,

<!DOCTYPE html PUBLIC "">
<head>
<style>
#mySprite{
    background:url('image.gif') 0 -480px;
    left:0px;
    width:13px;
    }
</style>
<script type="text/javascript" src="js/jquery-1.4.min.js"></script>
<script type='text/javascript'>
    var fontSizes = [14, 16]
    $(function(){
      $('#PlusMinus').click(function() {
            if($(this).val() == "+") {
            $('#OurText').css('fontSize', fontSizes[1] + 'px');
            $(this).val("-");
        }
        else {
            $('#OurText').css('fontSize', fontSizes[0]+ 'px');
            $(this).val("+");
        }
           $("body .h6").toggle();
        });
    });
</script>
</head>
<body>
    <h6 class="noSpan">
    <!--MY INPUT TYPE NEED TO BE CSS STYLE-->
        <input type='button' class="cat" value='+' id='PlusMinus' />
        <span class="h6">Larger</span>
        <span class="h6" style="display: none">Smaller</span>
    </h6>
    <h5 id="OurText" class="p">TEXT</h5>
</body>
</html>
1
  • you want to change your button to have an id of 'myStyle' ? Commented Mar 7, 2011 at 19:41

1 Answer 1

1

If you want your styles to get applied, either change the id on the element to read the following:

<input type='button' class="cat" value='+' id='mySprite' />

Or, you can change your CSS rule to:

#PlusMinus
{
    background:url('image.gif') 0 -480px;
    left:0px;
    width:13px;
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.