0

below is my html page, which contains a button. in my button input.ui-button { padding: 0.4em 1em; } style is added to buttons. it is adding it from jquery-ui.css . i have to add in-line to change padding values. but i can't add this as per instruction. please suggest me is there any other way to set these values other than in-line style.

       <body>
       <input type="button" onclick="javascript:submitForm('reset');" class="ui-button- default ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" 
       value="Reset">
      </body>
4
  • 4
    You should have a separate CSS document anyway. Inline CSS is generally a bad idea. When you've got that sorted, you can use the .css() method in jQuery. Commented Dec 7, 2011 at 12:21
  • 1
    Are you using jQuery.js in your code? why are you still using onclick? Commented Dec 7, 2011 at 12:22
  • thanks polynomial, i have added it in separate .css file but it is not reflecting until i add it like inline. Commented Dec 7, 2011 at 12:27
  • @David Laberge: i am using query.min.js,query-ui.min.js . and what to use for onClick() ? please suggest. thanks Commented Dec 7, 2011 at 12:28

2 Answers 2

2

Try something like

  <body>
   <input type="button" id="btn" value="Reset">
  </body>

In Javascript:

$('#btn').button();                 // to apply the default css style of the jQuery UI boutton
$('#btn').css({'margin-left':'20px'}); // to modify the css of the element
$('#btn').click(function(){
   // This function is called when the bouton is clicked
});
Sign up to request clarification or add additional context in comments.

1 Comment

Cheers, also please change "boutton" to "button". :)
1

Just add your own style sheet overriding the .ui-button padding definition:

<style type="text/css">
    .ui-button {  padding: 0; }
</style> 

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.