Announcing the Global SNUG Board of Directors. Learn more here
‎03-03-2014 08:49 PM
Is there any way to change the description and picture when select from a "Select Box"? Thanks.
Solved! Go to Solution.
‎03-04-2014 02:37 AM
I can give you an idea on how you can do this.
Write an onchange client script on your select box field.
Script:
// Get all the images of your document
var image =document.images;
image[<position where your current image is>].src = <URL of your new image>;
//Lets say I want to replace the below iphone image to attachment clip icon.
var image =document.images;
alert(image[3].src);
image[4].src = 'https://demo010.service-now.com/images/icons/attachment.gifx';
Before script:
After script
:
You can use similar logic to change description also. Let me know if you have queries.
How to find the position of your image?
Answer: You can give few alerts to check your image position.
‎03-04-2014 01:56 AM
yes you can write an onchange client script and do that. Let me check if I can write the code for you.
‎03-04-2014 02:37 AM
I can give you an idea on how you can do this.
Write an onchange client script on your select box field.
Script:
// Get all the images of your document
var image =document.images;
image[<position where your current image is>].src = <URL of your new image>;
//Lets say I want to replace the below iphone image to attachment clip icon.
var image =document.images;
alert(image[3].src);
image[4].src = 'https://demo010.service-now.com/images/icons/attachment.gifx';
Before script:
After script
:
You can use similar logic to change description also. Let me know if you have queries.
How to find the position of your image?
Answer: You can give few alerts to check your image position.
‎03-04-2014 02:58 PM
Hi bhaveshumour, it works. Really thanks to that. Sorry, but what is the object component of description, is it document.description? Thanks. Heman
‎03-04-2014 07:15 PM
I can give you a hint but you might need to dig in more.
Try this script:
var desc = document.getElementsByClassName("catalog_description");
alert(desc[0].innerHTML);