GeekedOut
GeekedOut

Reputation: 17185

jQuery trying to display element inline gives error

I am trying to display an html element, but it has to have the inline attribute. The second line in my code breaks the html page:

$('#add_existing_suggestion').fadeIn(100).show();                                
$('#add_existing_suggestion').css("display":"inline");

I saw on this forum that it worked for people: http://forum.jquery.com/topic/fadein-inline

Any way I can make the element get displayed inline?

Thanks!!

Upvotes: 0

Views: 73

Answers (2)

Ninja
Ninja

Reputation: 5152

Your syntax is incorrect. The syntax for .css() is:

.css( propertyName )
.css( propertyName, value )

Change it to $('#add_existing_suggestion').css("display", "inline");

Upvotes: 1

ShankarSangoli
ShankarSangoli

Reputation: 69915

css method take two arguments as string or a map containing key/value pair of styles. What you are doing will give a syntax error on the page and will break other js also. Try this

$('#add_existing_suggestion').css("display", "inline");

Upvotes: 3

Related Questions