Get value from a string after a special character

后端 未结 4 692
生来不讨喜
生来不讨喜 2021-01-30 10:26

How do i trim and get the value after a special character from a hidden field The hidden field value is like this

Code



        
4条回答
  •  借酒劲吻你
    2021-01-30 11:07

    Assuming you have your hidden input in a jQuery object $myHidden, you then use JavaScript (not jQuery) to get the part after ?:

    var myVal = $myHidden.val ();
    var tmp = myVal.substr ( myVal.indexOf ( '?' ) + 1 ); // tmp now contains whatever is after ?
    

提交回复
热议问题