开发者

Problem with validating '<' character in input box

开发者 https://www.devze.com 2023-02-18 15:35 出处:网络
Whenever I get the .val() of input box with javascript, everything after and including the < character is not included. So if I put \"hello<yo\"i receive hello.

Whenever I get the .val() of input box with javascript, everything after and including the < character is not included. So if I put "hello<yo" i receive hello.

So a user typing '<' anywhere in the textbox will either submit a false input he didn't want, or receive the wrong err开发者_如何学Cor message

(i.e. if he inputs "<hello", it will say it's blank)

This seems to be fine in javascript alone. But I am getting the val() from javascript and then in ajax i am sending it to a php URl as a query string and validating it there on the php.

Any ideas?

Thank you.

EDIT: MY bad i didnt know there was a striptag() function being called in php


Instead of entering < try entering &lt;.

0

精彩评论

暂无评论...
验证码 换一张
取 消