-1

I have one select tag

I want to change select tag value from value="-1:Select;" to value="-1:Select;2:option1"

<select role="select" value="-1:Select;" id="brandingName" name="brandingName" size="1" class="FormElement">
</select>

value="-1:Select;"

I have tried with below syntax but it does not change:

document.getElementById("brandingName").value = "-1:Select;2:option1";

How can I change this value using JavaScript or jQuery?

4
  • Where is your try? Commented Dec 14, 2017 at 12:16
  • Can you add a JSFiddle to recreating this problem? Commented Dec 14, 2017 at 12:16
  • possible duplicate of stackoverflow.com/questions/10611170/… Commented Dec 14, 2017 at 12:17
  • 1
    There is no value attribute on select elements Commented Dec 14, 2017 at 14:23

1 Answer 1

3

You need to select the id and use attr to change value, like this with out having testing it.

$("#brandingName").attr("value", "-1:Select;2:option1")
Sign up to request clarification or add additional context in comments.

2 Comments

$(("#brandingName").val() ???
I have tried with also but its not working $(("#brandingName").val()

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.