I would like to place a image on a page

<img src="myimage.jpeg" id="imgid" style="display:none"/>

if (PerMonth <0){
  $("#imgid").css("what do i need here to display different image when <0)

if (PerMonth >0){
  $("#imgid").css("Display different image >0)

Any ideas and thanks in advance

closed as off topic by Alex Angas Aug 23 '10 at 23:52

Questions on SharePoint Stack Exchange are expected to relate to SharePoint within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here. If this question can be reworded to fit the rules in the help center, please edit the question.

  • I know you are doing this in SharePoint, but you should consider moving these non SharePoint questions to the more generic StackOverflow really. – Jeroen Ritmeijer - Muhimbi Aug 23 '10 at 9:39
  • @Patrick: Questions that aren't specifically about SharePoint don't belong here. Please ask your jQuery questions elsewhere unless they demonstrate integration with SharePoint. Thanks! – Alex Angas Aug 23 '10 at 23:53

Your .css could use the background-image property:


Or you may want to use simply modify the .src property instead of the .css of your jquery selector.


Try this,

if (PerMonth <0){ $(this).css("background-color","#FFFF00") $("#imgid").attr("src","image1.jpg") ;}

if (PerMonth >0){ $(this).css("background-color","#FFFF00") $("#imgid").attr("src","image2.jpg") ;}

Not the answer you're looking for? Browse other questions tagged or ask your own question.