0

Find selection with dynamic value having space

like 'ltrY2axisTopUp Acmount' I have

var val = 'ltrY2axisTopUp Acmount' now i want to find like this

$(':input[value=' + val + ']')

It says

Error: Syntax error, unrecognized expression: #lsltrY2axis option[value=ltrY2axisTopUp Acmount]

2 Answers 2

2

Try

$(':input[value="' + val + '"]')

Notice " double quotes

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, Very silly mistake :) i will marked it as best answer, as it will allow me after 10 minutes Thanks
1

Enclose the value in ""

$(':input[value="' + val + '"]')

Comments

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.