4

Ok I have the css sorted:

Now to style the input box ( but this isnt working ) any suggestions. Think my js is messed up. The html element:

<input name="latLng" class="latLng" id="latLng2" type="text" disabled />

The JS:

<script type="text/javascript">
jQuery(document).ready(function(){
    jQuery('input.latLng').locationPicker({
    width: "500px",
    height: "20px",
    backgroundColor: '#fff',
    border: '1px solid #ccc',
    borderRadius: 10,
    padding: 10
    });
});
</script>

Where am I going wrong please.

3
  • To format, select your code and click the 101010 button at the top, or indent it over 4 spaces manually :) Commented Nov 9, 2010 at 23:08
  • Or select the code and ctrl+K Commented Nov 9, 2010 at 23:15
  • Or type backquotes (`) around the snippet to do inline code. Commented Nov 10, 2010 at 0:15

1 Answer 1

2

To set styles, use .css() for the styling of the element and call your plugin separately, like this:

jQuery(document).ready(function(){
    jQuery('input.latLng').css({
    width: "500px",
    height: "20px",
    backgroundColor: '#fff',
    border: '1px solid #ccc',
    borderRadius: 10,
    padding: 10
    }).locationPicker();
});

Or, a bit shorter:

jQuery(function($){
    $('input.latLng').css({
      width: 500,
      height: 20,
      backgroundColor: '#fff',
      border: '1px solid #ccc',
      borderRadius: 10,
      padding: 10
    }).locationPicker();
});
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks Nick, will try that ( I am trying to get the hang of SO )
Ok now code is: <pre><script type="text/javascript"> jQuery(function($){ $('input.latLng').css({ width: 300, height: 18, padding: '4px', backgroundColor: '#fff', border: '1px solid #ccc', borderRadius: '3px', padding: '3px' }).locationPicker(); }); </script></pre> all seems to work fine, just rounded corners arent really showing ( chosen 3px to match other form elements )

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.